fix: register ACP MCP tools as native callable tools via cpython proxy - #2002
Open
sethkarten wants to merge 6 commits into
Open
fix: register ACP MCP tools as native callable tools via cpython proxy#2002sethkarten wants to merge 6 commits into
sethkarten wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 41985b9. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No-Ticket: Evaluation-driven ACP compatibility fix; no Linear ticket was created.
Problem
When verifiers sends MCP tool servers through the ACP
session/new(mcp_servers=...)protocol, prime-agent stores them correctly but only adds prose guidance to the system prompt. The model must infer the correctawait mcp.call_tool(...)incantation — a reasoning step that often fails, causing fallback to website scraping via cpython.Solution
Register native
ToolDefinitionentries for each ACP MCP server. The model sees typed, callable tool entries in its tool list. Execution routes through the IPython kernel viaawait mcp.call_tool(...)— consistent with prime-agent's cpython-first architecture.Each server gets two tools:
mcp_list_tools_{server}— discover tool names and schemasmcp_call_{server}— call a tool with JSON argumentsChanges
tools/acp-mcp.tsmcp.call_tool()in the kerneltools/index.tscreateAcpMcpToolDefinitionsagent-session.ts_rebuildRuntimeForAcpMcpServersmcp-manager.tsgetAcpServers()public getterNote
Medium Risk
Changes tool registration, active tool sets, and system prompts for ACP sessions; incorrect teardown or naming could break MCP access or hide tools from the model, but behavior is covered by new regression tests.
Overview
ACP-supplied MCP servers are no longer only documented in the system prompt as generic
mcp.list_tools/mcp.call_toolexamples. Each ACP server now gets two first-class agent tools—mcp_list_tools_{server}andmcp_call_{server}—implemented inacp-mcp.tsand executed through the IPython kernel’s MCP API.agent-sessionbuilds and registers these definitions when ACP servers are set or the runtime is rebuilt, adds them to the active tool set, and tears them out of the registry, allowed names, and prompt onreleaseAcpMcpServers. Registration fails without the built-in cpython provisioner or if generated tool names collide with base, custom, or extension tools.mcp-managersplits listing:getAcpServers()for session-scoped ACP configs andgetEnabledPersistentGenericServers()for user-declared servers, so ACP servers are excluded from generic MCP prose in the system prompt while persistent servers still are.Reviewed by Cursor Bugbot for commit 36de03e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Register ACP MCP tools as native callable tools via cpython proxy
getAcpServersandgetEnabledPersistentGenericServers.Macroscope summarized 36de03e.