Skip to content

chore: separate toolset creation from init and use typed error #487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

SamMorrowDrums
Copy link
Collaborator

This PR makes it easier to identify the error when a toolset does not exist, and also separates toolset creation from initialization, so it's possible to compose toolsets in more ways.

@Copilot Copilot AI review requested due to automatic review settings June 6, 2025 11:28
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner June 6, 2025 11:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a typed error for missing toolsets and decouples toolset creation from enabling so callers can compose and enable toolsets separately.

  • Add ToolsetDoesNotExistError, replace fmt.Errorf with the new error type, and implement GetToolset().
  • Update tests to assert against the typed error and add new coverage for GetToolset.
  • Rename InitToolsets to DefaultToolsetGroup in GitHub integration and move enabling logic into the server initialization.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pkg/toolsets/toolsets.go Added ToolsetDoesNotExistError, new GetToolset, replaced error strings
pkg/toolsets/toolsets_test.go Updated tests to use errors.Is against the typed error, added TestToolsetGroup_GetToolset
pkg/github/tools.go Renamed InitToolsetsDefaultToolsetGroup, removed inline enabling
internal/ghmcp/server.go Changed server init to call EnableToolsets after creating the group
Comments suppressed due to low confidence (2)

pkg/github/tools.go:18

  • [nitpick] Consider renaming DefaultToolsetGroup to NewDefaultToolsetGroup or InitDefaultToolsetGroup to follow Go constructor naming conventions and clarify intent.
func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) *toolsets.ToolsetGroup {

pkg/toolsets/toolsets.go:15

  • The code calls fmt.Sprintf but fmt is not imported; add "fmt" to the import block to avoid a compilation error.
return fmt.Sprintf("toolset %s does not exist", e.Name)

Copy link
Member

@omgitsads omgitsads left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@SamMorrowDrums SamMorrowDrums merged commit c17ebfe into main Jun 6, 2025
16 checks passed
@SamMorrowDrums SamMorrowDrums deleted the toolset-improvements branch June 6, 2025 12:45
atxtechbro pushed a commit to atxtechbro/github-mcp-server that referenced this pull request Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants