Skip to content

feat(opencode): defer large MCP tool catalogs#34368

Closed
rekram1-node wants to merge 18 commits into
devfrom
deferred-tools
Closed

feat(opencode): defer large MCP tool catalogs#34368
rekram1-node wants to merge 18 commits into
devfrom
deferred-tools

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add experimental deferred MCP tool search/call bridge for large MCP tool catalogs
  • move MCP tool assembly into session/mcp-tools.ts and keep session/tools.ts focused on registry tools
  • add focused coverage for deferred, disabled, below-threshold, and deferred-server prompt behavior

Closes #8625

Enablement

Set OPENCODE_EXPERIMENTAL_TOOL_SEARCH=true to enable deferred MCP tool search. The umbrella OPENCODE_EXPERIMENTAL=true also enables it unless OPENCODE_EXPERIMENTAL_TOOL_SEARCH=false is set.

How it works

When enabled, MCP tools are still exposed directly unless their allowed schemas exceed the fixed internal deferral threshold. Large MCP tool catalogs are replaced with two stable bridge tools: search_deferred_tools for lexical discovery and call_deferred_tool for executing a returned tool_id. The provider-visible bridge schemas stay fixed, while the system prompt includes a compact list of deferred MCP servers and tool counts.

Tests

  • bun typecheck
  • bun test test/session/tools.test.ts
  • git diff --check

@rekram1-node

Copy link
Copy Markdown
Collaborator Author

closing in favor of codemode:
https://github.com/anomalyco/opencode/pull/34677/changes

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.

[FEATURE]:Add mcp search tool, reduce mcp tool occupying a lot of context

1 participant