Skip to content

feat(mcp-binding): a tool is a composable function - a @preload function per tool, bound in code - #55

Merged
acn-ericlaw merged 1 commit into
mainfrom
feat/mcp-binding-function-per-tool
Nov 16, 2026
Merged

acn-ericlaw merged 1 commit into
mainfrom
feat/mcp-binding-function-per-tool

Conversation

@acn-ericlaw

Copy link
Copy Markdown
Collaborator

What

The MCP binding is reshaped so that a tool of an MCP server is declared where every route is declared, in the code:
render = bind("mermaid", "validate_and_render_mermaid_diagram", schema_sha256="5ae6…") names the server, the remote tool
and the digest of its input schema and returns the tool as an async callable, and an ordinary @preload function calls it
(the extension's own mermaid.render, bound to the public Mermaid Chart MCP endpoint named in the default server file, so
the binding serves a tool out of the box with no credential). The server file keeps what is environment-specific (transport,
command or URL, credential references, timeout) and refuses a leftover tools allowlist by name. Boot connects every server
a function binds a tool of, lists its tools and stops the application by name when a bound server is not configured, a tool
is not offered or its schema no longer hashes to the pinned digest; a configured server nobody binds is not connected.
mcp.tool is no longer a route; mcp.health stays; describe prints each digest, the bind line to paste and a catalog
row whose route is the developer's. A route names the capability, never the transport. The shared vector file is version 2
(verify_cases over declared bindings), byte-identical with the Node twin; tests/test_mcp_binding.py has 49 tests (46
before); the README, the default server file and the unreleased CHANGELOG entry describe the final shape. ruff clean,
basedpyright 0 errors, pytest 410 passed, 64 skipped; describe mermaid and a live boot against the Mermaid server
rendered a flowchart through mermaid.render (200, the SVG) and refused a non-map body (400).

Why

The first shape, built on 2026-11-14, read a tools allowlist under each server and conjured each tool's route at boot as
an alias of a private mcp.tool function: a route no @preload declared, a route-to-tool table in a YAML file as a second
place to look, and a mechanism a developer could forget - the Playground's diagram.render called diagram.render.mcp,
which existed only because a YAML row said so. Eric's review of 2026-11-16 (the engines' draft-design-specs/agent-tool-use.md)
settled the principle: a tool is a composable function whatever stands behind it, the MCP client is fully encapsulated,
and the route must not carry the transport, because a tool may start as an MCP tool and later be implemented another way
while the graph stays unchanged. One route per tool with the digest pinned is kept, so ADR-0033 stands untouched, and a
generic public mcp.tool route (the ADR's rejected alternative) was considered in the debate and set aside. The Node twin
is opened in lockstep; the Playground example follows with mermaid.render.

🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com

…ion per tool, bound in code

The binding's first shape read a tools allowlist under each server and conjured each
tool's route at boot as an alias of a private mcp.tool function - a route no @preload
declared. Now a tool is declared where every route is declared: bind(server, tool,
schema_sha256) returns the tool as an async callable and an ordinary @preload function
calls it (the extension's own mermaid.render, bound to the public Mermaid Chart MCP
endpoint named in the default server file). The server file keeps servers only; boot
connects every server a function binds a tool of and stops by name on an unconfigured
server, a missing tool or a changed digest; mcp.tool is no longer a route. A route names
the capability, never the transport. The shared vectors are version 2 (verify cases over
declared bindings), byte-identical with the Node twin. Design: the engines'
draft-design-specs/agent-tool-use.md (Eric's review, 2026-11-16). ruff clean,
basedpyright 0 errors, pytest 410 passed; booted live against the Mermaid server and a
diagram rendered through mermaid.render.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@acn-ericlaw
acn-ericlaw merged commit cf216f3 into main Nov 16, 2026
5 checks passed
@acn-ericlaw
acn-ericlaw deleted the feat/mcp-binding-function-per-tool branch November 16, 2026 04:52
acn-ericlaw added a commit that referenced this pull request Nov 16, 2026
…ded as landed

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
acn-ericlaw added a commit that referenced this pull request Nov 16, 2026
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant