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
{{ message }}
Repository navigation
[FEATURE]:OpenCode MCP Tool Resolution Causes Large First-Turn and Per-Turn Overhead #19300
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
OpenCode MCP Tool Resolution Causes Large First-Turn and Per-Turn Overhead
Summary
We are embedding OpenCode as a long-lived local runtime inside another desktop app.
We found that session.create is not the main source of latency.
The main overhead comes from MCP tool resolution during session.prompt.
In current upstream behavior:
On the first prompt for a workspace, MCP initialization connects every enabled MCP server.
During MCP client creation, OpenCode immediately calls listTools().
On later prompts, OpenCode still calls listTools() again for every connected MCP client inside MCP.tools().
This creates noticeable first-turn latency and also adds repeated per-turn latency when many MCP servers are enabled or when some remote MCP servers are slow.
The description appears to be AI-generated — it's an extensive, heavily structured wall of text with code paths, multiple option sections, and implementation pseudocode that is not acceptable per our guidelines. Please replace it with a concise, human-written description of the problem and what you'd like to see changed.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
Feature Request: Two-Step MCP Tool Discovery for On-Demand Loading #16206: Feature Request: Two-Step MCP Tool Discovery for On-Demand Loading — covers the same core problem of listTools() being called on every prompt with no caching, and proposes similar solutions (cached tool listings, lazy loading).
If you believe this was flagged incorrectly, please let a maintainer know.
Activity
github-actions commentedon Mar 26, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
listTools()being called on every prompt with no caching, and proposes similar solutions (cached tool listings, lazy loading).If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Mar 26, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.