feat(0.22.1): mcpToolsForRuntimeMcp() — project MCP tools to OpenAI shape#53
Closed
tangletools wants to merge 1 commit into
Closed
feat(0.22.1): mcpToolsForRuntimeMcp() — project MCP tools to OpenAI shape#53tangletools wants to merge 1 commit into
tangletools wants to merge 1 commit into
Conversation
…hape The 0.22.0 OpenAI-compat backend accepts `tools[]` + `toolChoice` but does not auto-discover MCP tools from a parent sandbox's profile. Callers that route through tcloud / cli-bridge / OpenRouter / OpenAI direct must hand the model an explicit OpenAI Chat Completions `tools[]` array. `mcpToolsForRuntimeMcp()` returns the canonical projection of the 5 delegation tools (delegate_code, delegate_research, delegate_feedback, delegation_status, delegation_history) wired off the existing DELEGATE_*_TOOL_NAME / DELEGATE_*_DESCRIPTION / DELEGATE_*_INPUT_SCHEMA constants so the projection cannot drift from the server's validators. `mcpToolsForRuntimeMcpSubset(names)` returns a curated filter for callers that want a partial mount (e.g. read-only history without the coder queue). Sandbox-SDK callers do not need this helper — the sandbox runtime mounts MCP servers natively and the in-sandbox harness discovers tools via the runtime, not the OpenAI tools array.
Contributor
|
Obsolete — solving wrong problem. The eval gap is that it bypasses the sandbox harness entirely; the right fix is routing eval through ensureWorkspaceSandbox + streamSandboxPrompt (or running real multi-shot with inline tool execution). Closing. |
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.
Summary
mcpToolsForRuntimeMcp()projects the 5 agent-runtime MCP delegation tools (delegate_code,delegate_research,delegate_feedback,delegation_status,delegation_history) into the OpenAI Chat Completionstools[]shape consumed bycreateOpenAICompatibleBackend.mcpToolsForRuntimeMcpSubset(names)filters that projection to a curated subset.DELEGATE_*_TOOL_NAME/DELEGATE_*_DESCRIPTION/DELEGATE_*_INPUT_SCHEMAconstants so the projection cannot drift from the server's own validators./mcpso eval / orchestrator code can passtools: mcpToolsForRuntimeMcp()directly.Sandbox-SDK callers do not need this helper — the sandbox runtime mounts MCP servers natively and the in-sandbox harness discovers tools through the runtime, not through an OpenAI
tools[]array.Why
0.22.0 added
tools+toolChoicetocreateOpenAICompatibleBackend, but the backend does not auto-discover tools from a parent sandbox'sAgentProfile.mcpServers. Eval harnesses that wire tcloud / cli-bridge against an MCP-mounted runtime were not surfacing the delegation tools to the LLM. The gtm-agent canonical-delegation eval observeddelegate_research: 0/3, delegate_code: 0/1, composite=0.07because the model had no idea the tools existed.This helper closes the projection gap. The companion PR in
gtm-agentwires it throughcanonical-delegationso the eval can fire delegations end-to-end.Test plan
pnpm typecheckpnpm test— 267 tests pass, 11 new intests/mcp/openai-tools.test.tspnpm build— tsup clean (helper bundled intodist/mcp/index.js+ package root)pnpm exec biome check src tests— clean