Skip to content

refactor: remove dynamic toolsets and deprecated closure constructor#2512

Merged
SamMorrowDrums merged 1 commit into
mainfrom
sammorrowdrums/remove-dynamic-toolsets
May 20, 2026
Merged

refactor: remove dynamic toolsets and deprecated closure constructor#2512
SamMorrowDrums merged 1 commit into
mainfrom
sammorrowdrums/remove-dynamic-toolsets

Conversation

@SamMorrowDrums
Copy link
Copy Markdown
Collaborator

What & why

Removes the dynamic toolset discovery feature (the --dynamic-toolsets / GITHUB_DYNAMIC_TOOLSETS switch and the meta-tools enable_toolset, list_available_toolsets, get_toolset_tools) along with the deprecated closure-based NewServerToolWithDeps constructor that only existed to support it.

This is tech debt cleanup:

  • Dynamic mode was local-only — never offered by the remote server.
  • It carried real complexity: a separate config flag plumbed through stdio + http configs, a parallel registration path, four inventory methods (ToolsForToolset, IsToolsetEnabled, EnableToolset, EnabledToolsetIDs), an extra branch in ResolvedEnabledToolsets, three meta-tools, and a chunk of conformance/CI matrix.
  • After this PR there are exactly two server-tool constructors:
    • NewServerTool — raw mcp.ToolHandler, no closure, no unmarshalling
    • NewServerToolWithContextHandler[In, Out] — typed handler, deps via context
  • This repo isn't published as a stable library; downstream consumers can pin a version if they need the dynamic feature.

Diff highlights

  • pkg/github/dynamic_tools.go + test → deleted
  • pkg/inventory/server_tool.goNewServerToolWithDeps removed
  • pkg/inventory/filters.goToolsForToolset, IsToolsetEnabled, EnableToolset, EnabledToolsetIDs removed
  • ResolvedEnabledToolsets(dynamic, toolsets, tools)ResolvedEnabledToolsets(toolsets, tools)
  • DynamicToolsets field removed from MCPServerConfig, StdioServerConfig, http ServerConfig
  • --dynamic-toolsets flag removed
  • ToolsetMetadataDynamic removed; AvailableToolsets("context", "dynamic")AvailableToolsets("context")
  • README, server-configuration.md, toolsets-and-icons.md, copilot-instructions.md, conformance-test script — dynamic refs stripped
  • The .github/workflows/mcp-diff.yml change that drops the dynamic test matrix isn't included in this PR (OAuth scope) — please apply it as a follow-up

Verification

  • script/lint clean
  • script/test passes
  • script/generate-docs produces no extra diff after this commit

Stacks on (now merged) #2511.

@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner May 20, 2026 08:33
Copilot AI review requested due to automatic review settings May 20, 2026 08:33
@SamMorrowDrums SamMorrowDrums force-pushed the sammorrowdrums/remove-dynamic-toolsets branch from b962757 to 20e3c5f Compare May 20, 2026 08:35
Copy link
Copy Markdown
Contributor

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

Removes the local-only dynamic toolset discovery feature and its supporting plumbing (meta-tools, config/flags, inventory APIs), and deletes the deprecated closure-based NewServerToolWithDeps constructor to simplify the tool registration surface area.

Changes:

  • Removed dynamic toolset discovery mode end-to-end (CLI/env/config wiring, server registration path, docs, and conformance script coverage).
  • Simplified inventory/tool registration by removing dynamic toolset management APIs and the deprecated closure-based tool constructor.
  • Updated docs/help generation to exclude only the context toolset (since dynamic no longer exists).
Show a summary per file
File Description
script/conformance-test Removed dynamic-mode test paths and configs from conformance runner.
README.md Removed dynamic tool discovery documentation and updated tool configuration guidance.
pkg/inventory/server_tool.go Removed deprecated NewServerToolWithDeps constructor.
pkg/inventory/server_tool_test.go Dropped tests for the removed constructor; kept/updated context-handler tests.
pkg/inventory/registry.go Updated inventory doc comment to remove dynamic enabling reference.
pkg/inventory/registry_test.go Removed tests for deleted dynamic toolset inventory APIs.
pkg/inventory/filters.go Removed dynamic toolset management methods (ToolsForToolset, EnableToolset, etc.).
pkg/inventory/builder.go Updated toolset config docs now that “dynamic empty toolsets” mode is gone.
pkg/http/server.go Removed DynamicToolsets from HTTP server config.
pkg/http/handler.go Removed dynamic-toolsets branching and updated toolset resolution call signature.
pkg/http/handler_test.go Updated tests for new ResolvedEnabledToolsets signature.
pkg/github/tools.go Removed ToolsetMetadataDynamic; updated toolsets help generation exclusion list.
pkg/github/server.go Removed DynamicToolsets config and dynamic meta-tool registration; simplified toolset resolution.
pkg/github/server_test.go Updated ResolvedEnabledToolsets tests to match new behavior/signature.
pkg/github/dynamic_tools.go Deleted dynamic toolset management tools implementation.
pkg/github/dynamic_tools_test.go Deleted tests for removed dynamic toolset management tools.
internal/ghmcp/server.go Removed dynamic-toolsets config wiring and logging in stdio server setup.
docs/toolsets-and-icons.md Removed the “Dynamic” toolset icon entry.
docs/server-configuration.md Removed dynamic mode documentation and references.
docs/installation-guides/README.md Removed mention of dynamic tool discovery.
cmd/github-mcp-server/main.go Removed --dynamic-toolsets flag and associated viper binding/config propagation.
cmd/github-mcp-server/generate_docs.go Updated toolset documentation generation to stop excluding dynamic.
.github/copilot-instructions.md Removed dynamic toolsets env var/flag references from contributor guidance.

Copilot's findings

  • Files reviewed: 24/24 changed files
  • Comments generated: 1

Comment thread script/conformance-test Outdated
Dynamic toolset discovery (the meta-tools enable_toolset, list_available_toolsets,
get_toolset_tools and the --dynamic-toolsets / GITHUB_DYNAMIC_TOOLSETS switch)
was a local-only feature never offered by the remote server. Removing it
deletes a meaningful chunk of branching, configuration surface and tests
for a path no longer in active use.

The deprecated closure-based NewServerToolWithDeps generic constructor was
only kept around for the dynamic tool registration path and is removed
together with it. Going forward there are exactly two constructors:

- NewServerTool — raw mcp.ToolHandler, no closure, no unmarshalling
- NewServerToolWithContextHandler[In, Out] — typed handler, deps via context

Inventory methods that only existed for the dynamic path
(ToolsForToolset, IsToolsetEnabled, EnableToolset, EnabledToolsetIDs)
are removed. ResolvedEnabledToolsets loses its dynamic flag.

Also strips dynamic references from the README, server configuration
docs, copilot-instructions, mcp-diff workflow, and conformance-test
script.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SamMorrowDrums SamMorrowDrums force-pushed the sammorrowdrums/remove-dynamic-toolsets branch from 20e3c5f to 3c39808 Compare May 20, 2026 08:46
@SamMorrowDrums SamMorrowDrums merged commit 0f0506d into main May 20, 2026
19 checks passed
@SamMorrowDrums SamMorrowDrums deleted the sammorrowdrums/remove-dynamic-toolsets branch May 20, 2026 08:51
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.

2 participants