Repository navigation
Support function calling in the local API through MCP - #13
Merged
Merged
Conversation
Agents such as SolidCraft send `tools` and got a 400, because the subscription CLIs answer with text only. The CLIs do support MCP, so a request with tools now starts the CLI with one MCP server, served by the API at /mcp/<token>, that offers exactly the caller's functions. A model's call is returned as OpenAI `tool_calls` while the CLI waits on its MCP call; the caller's next request with `role: "tool"` results answers it and the same process carries on. The model uses its native tool calling, and later steps take a second or two instead of a new process with the whole conversation. Claude Code gets --mcp-config with --allowedTools mcp__client (its own tools stay off); Codex gets the server as its only MCP server with default_tools_approval_mode="approve", since codex exec never asks. Idle sessions stop after 10 minutes, at most 8 wait at once, and a request whose results match no session starts over from the written-out conversation. Gemini CLI is not wired up yet and answers tools with 400.
redacid
pushed a commit
that referenced
this pull request
Dec 3, 2026
Version bump and changelog for function calling in the local API (#13).
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.
Agents that send
tools(SolidCraft, for one) gotHTTP 400 tools (function calling) are not supported. This adds native function calling forclaude/…andcodex/…models.How
toolsstarts the CLI with one MCP server,client, served by the API itself at/mcp/<random token>and offering exactly the caller's functions. The CLI's own tools stay off.tool_calls(finish_reason: "tool_calls") while the CLI waits on its MCP call.role: "tool"results (matchingtool_call_id) answers those calls; the same process continues.Per tool
--mcp-config+--strict-mcp-config+--allowedTools mcp__client, built-in tools still--tools "".-c mcp_servers={client={url=…,tool_timeout_sec=3600,default_tools_approval_mode="approve"}}(without approve modecodex execrefuses MCP calls).toolsget 400.Tested
make check: 192 tests (newbridge.test.ts: full loop throughApiServer, streaming, restart from transcript, idle stop).ApiServer: Codex called the function and answered with its result (6.3 s, then 2 s); Claude Code (haiku, streaming) the same (3.4 s, then 1.4 s); no sessions left afterwards.Docs:
docs/api.md(Function calling),docs-dev/architecture.md, OpenAPI description, README status.