-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Migrate 4 Search Tools to Go SDK #1468
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
base: omgitsads/go-sdk
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 migrates 4 search tools (search_repositories, search_code, search_users, search_orgs) from the legacy MCP framework to the new Go SDK, enabling them in the default toolset configuration.
Key changes:
- Migrated from
mark3labs/mcp-gotomodelcontextprotocol/go-sdk/mcp - Updated function signatures to return
(mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) - Replaced builder-pattern tool definitions with direct struct initialization using
jsonschema.Schema
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/github/search.go | Migrated 4 search tool implementations to Go SDK pattern, updated imports, changed error handling to use utils package, replaced status code literals with http.StatusOK constant |
| pkg/github/search_test.go | Updated tests to work with new SDK - removed build ignore directive, added jsonschema import, updated schema assertions to cast InputSchema to *jsonschema.Schema, updated handler calls to match new 3-return signature |
| pkg/github/tools.go | Re-enabled search tools by uncommenting SearchRepositories, SearchCode, SearchUsers, and SearchOrgs registrations, and adding users and orgs toolsets to the toolset group |
| pkg/github/toolsnaps/search_*.snap | Updated tool schema snapshots to reflect new JSON schema serialization format with reordered fields (type/required moved, properties field ordering changed) |
|
I've already fixed the error there, I just need to remove the function that's not available to me, I don't have it, so my work is done. |
harshul-narvar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall Review
This PR successfully migrates 4 search tools from the old MCP SDK (mark3labs/mcp-go) to the new Go SDK (modelcontextprotocol/go-sdk). The migration follows the expected patterns and the code changes look correct. Here are my observations:
✅ Positive Aspects
- Correct SDK Migration: The migration from builder pattern to JSON Schema-based tool definitions is properly implemented.
- Handler Signature Updates: All handler functions correctly use the new signature
func(ctx context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error). - Error Handling: Consistent use of
utils.NewToolResultErrorandutils.NewToolResultErrorFromErrthroughout. - Status Code Check: Good change from magic number
200tohttp.StatusOK. - Test Updates: Tests are properly updated to match the new handler signature and schema structure.
- Tool Registration: Tools are correctly re-enabled in
tools.go.
⚠️ Potential Issues
-
WithPagination Function: The PR calls
WithPagination(schema)with a schema parameter, but I don't see this function signature in the current codebase. The existingWithPagination()returnsmcp.ToolOptionfor the old SDK. Please verify that the base branch (omgitsads/go-sdk) has aWithPagination(*jsonschema.Schema)function that adds pagination properties to the schema. -
OptionalPaginationParams Function: The PR calls
OptionalPaginationParams(args)whereargsismap[string]any, but the current implementation takesmcp.CallToolRequest. Please confirm that the base branch has an overloaded version that acceptsmap[string]anyor that the helper functions (RequiredParam,OptionalParam, etc.) have been updated to work withmap[string]any. -
Helper Functions: The PR uses
RequiredParam[string](args, "query")and similar functions withargs(which ismap[string]any). These functions currently expectmcp.CallToolRequest. Please verify these helper functions have been updated in the base branch to acceptmap[string]any.
📝 Minor Suggestions
-
Consistency: The PR consistently uses
utils.NewToolResultErrorandutils.NewToolResultErrorFromErr, which is good. Make sure theutilspackage exists and these functions are available. -
Test Coverage: The tests look comprehensive and properly updated. The addition of
toolsnaps.TestforTest_SearchOrgsis a good catch. -
Code Organization: The migration is clean and well-organized. The removal of
//go:build ignoreis correct.
✅ Ready to Merge (with caveats)
Assuming the base branch has:
WithPagination(*jsonschema.Schema)function- Updated helper functions that accept
map[string]any - The
utilspackage with the result helper functions
This PR looks ready to merge. The migration is thorough and follows the expected patterns for the Go SDK migration.
Recommendation: Please verify that all the helper functions and WithPagination exist in the base branch with the expected signatures before merging.


Closes: Part of #1428
Migrates the 4 tools found in
search.go:repostoolset:search_repositoriessearch_codeuserstoolset:search_usersorgstoolset:search_orgs