Repository navigation
Tell clients our version, and which tools are safe to run - #178
Merged
Merged
Conversation
Two of the three findings from the protocol harness, fixed; the third turned out to be narrower than it looked and is now documented instead. **serverInfo.version was the empty string.** The identity carries the release and the SDK's Server takes version=, but neither route_table_to_mcp_server nor MCPAdapter.__init__ upstream accepts one, so nothing forwarded it. Every client was told this server had no version, which breaks the ordinary way a bug report establishes what was running. _stamp_version sets it on both construction paths and collapses to nothing the day either constructor grows the parameter. **No tool declared annotations.** readOnlyHint and friends are how a client decides what to auto-approve, and with none set a pure capability query was indistinguishable from a tool that uploads to a cluster. The map in annotations.py classifies the surface under three rules, written down because a wrong hint is worse than no hint: read-only means no side effect anywhere rather than "does not write the file it was given"; anything unclassified gets no annotation rather than a guess; destructive means it can overwrite data the user cares about, not merely that it writes something. Rendering a figure into the artifact store is a write; uploading over a path on a cluster is destructive. Upstream's make_mcp_tool takes no annotations argument and builds every Tool inside a closure, so there is no seam at construction -- the registered tools/list handler is wrapped instead. mcp 2.x stores a HandlerEntry rather than a bare callable, and replacing it with a plain function makes every tools/list fail with "'function' object has no attribute 'params_type'"; the wrapper is rebuilt as the same type. **outputSchema was not actually wired to one tool.** Five operations declare a contract and the registry attaches a schema to all five -- asserted on the route table. Only run_analysis reaches tools/list, because the other four are deferred and reached through call_deferred rather than listed. That is a property of the deferral design, not of the schema plumbing, and widening it means deciding which tools earn a place in the context window. Pinned as a test so the decision stays visible. tests/test_tool_annotations.py checks the map directly rather than through the wire, because deferred-full publishes 35 of its 72 tools and the transfer tools -- the ones whose classification matters most -- are never listed. It also fails on an entry naming a tool that no longer exists, since a stale name annotates nothing while still reading as a deliberate safety claim. SECURITY.md records that these hints are advisory by specification and that enforcement remains the precondition layer and the endpoint's own read/write roots.
The formatter rewrote this file after it was staged on the previous commit, so the committed copy was the pre-format one and CI's pre-commit job failed on a diff that had already been applied locally. Formatting only; no behaviour change.
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.
Acts on the findings from #174's protocol harness. Two were real bugs and are fixed; the third turned out narrower than it looked and is documented instead.
1.
serverInfo.versionwas""The identity carries the release and the SDK's
Serveracceptsversion=, but neitherroute_table_to_mcp_servernorMCPAdapter.__init__upstream takes one — so nothing forwarded it. Every client was told this server has no version, which breaks the ordinary way a bug report establishes what was running._stamp_versionsets it on both construction paths and collapses to nothing the day either constructor grows the parameter. Verified on the CLIserve_mcppath too, not justmake_mcp_server.2. No tool declared annotations
readOnlyHintand friends are how a client decides what to auto-approve. With none set,get_capabilitieswas indistinguishable from a tool that uploads to a cluster.src/uxarray_mcp/annotations.pyclassifies the surface under three rules, written down because a wrong hint is worse than no hint — a tool falsely marked read-only gets auto-approved and the user never sees the prompt that would have caught it:Two implementation notes. Upstream's
make_mcp_tooltakes no annotations argument and builds everyToolinside a closure, so there is no seam at construction — the registeredtools/listhandler is wrapped instead. And mcp 2.x stores aHandlerEntry, not a bare callable: replacing it with a plain function makes everytools/listfail with'function' object has no attribute 'params_type'. Hit that, so the wrapper is rebuilt as the same type.3.
outputSchema— not what it looked likeThe harness reported 1 of 33, which I read as "machinery wired to almost nothing". Checking properly: five operations declare a contract and the registry attaches a schema to all five (asserted on the route table). Only
run_analysisreachestools/listbecause the other four are deferred — reached viacall_deferredrather than listed.So this is a property of the deferral design, not broken plumbing. Widening it means deciding which tools earn a place in the context window, which is a judgement call rather than a fix. Pinned as a test so the decision stays visible.
Tests
tests/test_tool_annotations.pychecks the map directly rather than through the wire, becausedeferred-fullpublishes 35 of its 72 tools and the transfer tools — whose classification matters most — are never listed. It also fails on an entry naming a tool that no longer exists, since a stale name annotates nothing while still reading as a deliberate safety claim.The two characterisation tests from #174 flipped red when fixed, exactly as intended, and are now rewritten as positive assertions.
mypy caught a real
"None" not callablein the handler rebuild during this work — fixed, not suppressed.Note
SECURITY.mdnow records that these hints are advisory by specification and that enforcement remains the precondition layer and the endpoint's ownremote_read_root/remote_write_root. They are a usability signal, not a control.