You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migrate dynamic toolset to modelcontextprotocol/go-sdk (#1450)
* Initial plan
* Migrate dynamic toolset to modelcontextprotocol/go-sdk
This commit migrates the dynamic toolset (enable_toolset, list_available_toolsets,
get_toolset_tools) from mark3labs/mcp-go to modelcontextprotocol/go-sdk.
Changes:
- Removed //go:build ignore tag
- Updated imports to use modelcontextprotocol/go-sdk
- Migrated all tool functions to use new SDK patterns
- Updated ToolsetEnum helper to return []any instead of mcp.PropertyOption
- Converted DSL-based schema definitions to jsonschema.Schema structures
- Updated handler signatures to use map[string]any args
- Replaced old result helpers with utils package equivalents
- Fixed EnableToolset to use RegisterFunc instead of AddTools
- Created comprehensive test suite for all three tools
- Generated toolsnaps for the new tools
Related to #1428
Co-authored-by: omgitsads <[email protected]>
* Enable dynamic tools
* Remove new test and toolsnaps, we can follow up with this
* Just return the tool and handler directly instead of assigning to variables first.
This stops copilot complaining in review that the variables are unused.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: omgitsads <[email protected]>
Co-authored-by: Adam Holt <[email protected]>
funcEnableToolset(s*server.MCPServer, toolsetGroup*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
25
-
returnmcp.NewTool("enable_toolset",
26
-
mcp.WithDescription(t("TOOL_ENABLE_TOOLSET_DESCRIPTION", "Enable one of the sets of tools the GitHub MCP server provides, use get_toolset_tools and list_available_toolsets first to see what this will enable")),
27
-
mcp.WithToolAnnotation(mcp.ToolAnnotation{
23
+
funcEnableToolset(s*mcp.Server, toolsetGroup*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
24
+
return mcp.Tool{
25
+
Name: "enable_toolset",
26
+
Description: t("TOOL_ENABLE_TOOLSET_DESCRIPTION", "Enable one of the sets of tools the GitHub MCP server provides, use get_toolset_tools and list_available_toolsets first to see what this will enable"),
27
+
Annotations: &mcp.ToolAnnotations{
28
28
Title: t("TOOL_ENABLE_TOOLSET_USER_TITLE", "Enable a toolset"),
29
29
// Not modifying GitHub data so no need to show a warning
30
-
ReadOnlyHint: ToBoolPtr(true),
31
-
}),
32
-
mcp.WithString("toolset",
33
-
mcp.Required(),
34
-
mcp.Description("The name of the toolset to enable"),
funcListAvailableToolsets(toolsetGroup*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
65
-
returnmcp.NewTool("list_available_toolsets",
66
-
mcp.WithDescription(t("TOOL_LIST_AVAILABLE_TOOLSETS_DESCRIPTION", "List all available toolsets this GitHub MCP server can offer, providing the enabled status of each. Use this when a task could be achieved with a GitHub tool and the currently available tools aren't enough. Call get_toolset_tools with these toolset names to discover specific tools you can call")),
67
-
mcp.WithToolAnnotation(mcp.ToolAnnotation{
72
+
funcListAvailableToolsets(toolsetGroup*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
73
+
return mcp.Tool{
74
+
Name: "list_available_toolsets",
75
+
Description: t("TOOL_LIST_AVAILABLE_TOOLSETS_DESCRIPTION", "List all available toolsets this GitHub MCP server can offer, providing the enabled status of each. Use this when a task could be achieved with a GitHub tool and the currently available tools aren't enough. Call get_toolset_tools with these toolset names to discover specific tools you can call"),
76
+
Annotations: &mcp.ToolAnnotations{
68
77
Title: t("TOOL_LIST_AVAILABLE_TOOLSETS_USER_TITLE", "List available toolsets"),
funcGetToolsetsTools(toolsetGroup*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
99
-
returnmcp.NewTool("get_toolset_tools",
100
-
mcp.WithDescription(t("TOOL_GET_TOOLSET_TOOLS_DESCRIPTION", "Lists all the capabilities that are enabled with the specified toolset, use this to get clarity on whether enabling a toolset would help you to complete a task")),
101
-
mcp.WithToolAnnotation(mcp.ToolAnnotation{
111
+
funcGetToolsetsTools(toolsetGroup*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
112
+
return mcp.Tool{
113
+
Name: "get_toolset_tools",
114
+
Description: t("TOOL_GET_TOOLSET_TOOLS_DESCRIPTION", "Lists all the capabilities that are enabled with the specified toolset, use this to get clarity on whether enabling a toolset would help you to complete a task"),
115
+
Annotations: &mcp.ToolAnnotations{
102
116
Title: t("TOOL_GET_TOOLSET_TOOLS_USER_TITLE", "List all tools in a toolset"),
103
-
ReadOnlyHint: ToBoolPtr(true),
104
-
}),
105
-
mcp.WithString("toolset",
106
-
mcp.Required(),
107
-
mcp.Description("The name of the toolset you want to get the tools for"),
0 commit comments