Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
26e5bf0
refactor: convert projects, labels, and dynamic_tools to NewTool pattern
SamMorrowDrums Dec 13, 2025
2812f7f
Add --features CLI flag for feature flag support
SamMorrowDrums Dec 13, 2025
2415db2
Add validation tests for tools, resources, and prompts metadata
SamMorrowDrums Dec 13, 2025
08ac7ce
Fix default toolsets behavior when not in dynamic mode
SamMorrowDrums Dec 13, 2025
148a561
refactor: address PR review feedback for toolsets
SamMorrowDrums Dec 14, 2025
26c2271
refactor: Apply HandlerFunc pattern to resources for stateless NewToo…
SamMorrowDrums Dec 14, 2025
3a98f6a
refactor: simplify ForMCPRequest switch cases
SamMorrowDrums Dec 14, 2025
fdb62b4
refactor(generate_docs): use strings.Builder and AllTools() iteration
SamMorrowDrums Dec 14, 2025
44bce89
feat(toolsets): add AvailableToolsets() with exclude filter
SamMorrowDrums Dec 14, 2025
da84711
refactor(generate_docs): hoist success logging to generateAllDocs
SamMorrowDrums Dec 14, 2025
3ba1595
refactor: consolidate toolset validation into ToolsetGroup
SamMorrowDrums Dec 14, 2025
6f2776e
refactor: rename toolsets package to registry with builder pattern
SamMorrowDrums Dec 15, 2025
b142796
fix: remove unnecessary type arguments in helper_test.go
SamMorrowDrums Dec 15, 2025
5de7093
fix: restore correct behavior for --tools and --toolsets flags
SamMorrowDrums Dec 15, 2025
f363068
Move labels tools to issues toolset
SamMorrowDrums Dec 15, 2025
7b9e898
Restore labels toolset with get_label in both issues and labels
SamMorrowDrums Dec 15, 2025
7153a66
Fix instruction generation and capability advertisement
SamMorrowDrums Dec 15, 2025
63fb766
Add tests for dynamic toolset management tools
SamMorrowDrums Dec 15, 2025
1bea4c2
Advertise all capabilities in dynamic toolsets mode
SamMorrowDrums Dec 15, 2025
3939e55
Improve conformance test with dynamic tool calls and JSON normalization
SamMorrowDrums Dec 15, 2025
c87ee58
Add conformance-report to .gitignore
SamMorrowDrums Dec 15, 2025
f820f87
Add conformance test CI workflow
SamMorrowDrums Dec 15, 2025
15d8b6e
Add map indexes for O(1) lookups in Registry
SamMorrowDrums Dec 15, 2025
17372f2
perf(registry): O(1) HasToolset lookup via pre-computed set
SamMorrowDrums Dec 15, 2025
9dfcc6e
simplify: remove lazy toolsByName map - not needed for actual use cases
SamMorrowDrums Dec 15, 2025
d746793
Add generic tool filtering mechanisms to registry package
Copilot Dec 16, 2025
51d8a7e
docs: improve filter evaluation order and FilteredTools documentation
SamMorrowDrums Dec 16, 2025
fae9d5c
Refactor GenerateToolsetsHelp() to use strings.Builder pattern
Copilot Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 50 additions & 50 deletions pkg/github/dynamic_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ func ToolsetEnum(toolsetGroup *toolsets.ToolsetGroup) []any {
return toolsetNames
}

func EnableToolset(s *mcp.Server, toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
return mcp.Tool{
Name: "enable_toolset",
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"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ENABLE_TOOLSET_USER_TITLE", "Enable a toolset"),
// Not modifying GitHub data so no need to show a warning
ReadOnlyHint: true,
},
InputSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"toolset": {
Type: "string",
Description: "The name of the toolset to enable",
Enum: ToolsetEnum(toolsetGroup),
},
func EnableToolset(s *mcp.Server, toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) toolsets.ServerTool {
return toolsets.NewServerToolLegacy(mcp.Tool{
Name: "enable_toolset",
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"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ENABLE_TOOLSET_USER_TITLE", "Enable a toolset"),
// Not modifying GitHub data so no need to show a warning
ReadOnlyHint: true,
},
InputSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"toolset": {
Type: "string",
Description: "The name of the toolset to enable",
Enum: ToolsetEnum(toolsetGroup),
},
Required: []string{"toolset"},
},
Required: []string{"toolset"},
},
},
mcp.ToolHandlerFor[map[string]any, any](func(_ context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
// We need to convert the toolsets back to a map for JSON serialization
toolsetName, err := RequiredParam[string](args, "toolset")
Expand All @@ -64,22 +64,22 @@ func EnableToolset(s *mcp.Server, toolsetGroup *toolsets.ToolsetGroup, t transla
toolset.RegisterTools(s)

return utils.NewToolResultText(fmt.Sprintf("Toolset %s enabled", toolsetName)), nil, nil
})
}))
}

func ListAvailableToolsets(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
return mcp.Tool{
Name: "list_available_toolsets",
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"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_LIST_AVAILABLE_TOOLSETS_USER_TITLE", "List available toolsets"),
ReadOnlyHint: true,
},
InputSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{},
},
func ListAvailableToolsets(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) toolsets.ServerTool {
return toolsets.NewServerToolLegacy(mcp.Tool{
Name: "list_available_toolsets",
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"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_LIST_AVAILABLE_TOOLSETS_USER_TITLE", "List available toolsets"),
ReadOnlyHint: true,
},
InputSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{},
},
},
mcp.ToolHandlerFor[map[string]any, any](func(_ context.Context, _ *mcp.CallToolRequest, _ map[string]any) (*mcp.CallToolResult, any, error) {
// We need to convert the toolsetGroup back to a map for JSON serialization

Expand All @@ -103,29 +103,29 @@ func ListAvailableToolsets(toolsetGroup *toolsets.ToolsetGroup, t translations.T
}

return utils.NewToolResultText(string(r)), nil, nil
})
}))
}

func GetToolsetsTools(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
return mcp.Tool{
Name: "get_toolset_tools",
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"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_GET_TOOLSET_TOOLS_USER_TITLE", "List all tools in a toolset"),
ReadOnlyHint: true,
},
InputSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"toolset": {
Type: "string",
Description: "The name of the toolset you want to get the tools for",
Enum: ToolsetEnum(toolsetGroup),
},
func GetToolsetsTools(toolsetGroup *toolsets.ToolsetGroup, t translations.TranslationHelperFunc) toolsets.ServerTool {
return toolsets.NewServerToolLegacy(mcp.Tool{
Name: "get_toolset_tools",
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"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_GET_TOOLSET_TOOLS_USER_TITLE", "List all tools in a toolset"),
ReadOnlyHint: true,
},
InputSchema: &jsonschema.Schema{
Type: "object",
Properties: map[string]*jsonschema.Schema{
"toolset": {
Type: "string",
Description: "The name of the toolset you want to get the tools for",
Enum: ToolsetEnum(toolsetGroup),
},
Required: []string{"toolset"},
},
Required: []string{"toolset"},
},
},
mcp.ToolHandlerFor[map[string]any, any](func(_ context.Context, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
// We need to convert the toolsetGroup back to a map for JSON serialization
toolsetName, err := RequiredParam[string](args, "toolset")
Expand Down Expand Up @@ -154,5 +154,5 @@ func GetToolsetsTools(toolsetGroup *toolsets.ToolsetGroup, t translations.Transl
}

return utils.NewToolResultText(string(r)), nil, nil
})
}))
}
Loading