Skip to content

feat(mcp): declare read-only annotations on all five MCP tools - #32

Merged
khanrc merged 1 commit into
mainfrom
gh-1755-tool-annotations
Jul 27, 2026
Merged

khanrc merged 1 commit into
mainfrom
gh-1755-tool-annotations

Conversation

@khanrc

@khanrc khanrc commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Every tool in the MCP router reads the local index and mutates nothing, but none of them declared that. An MCP client that sees no annotations must assume the tool is destructive and open-world, and some clients then demand an approval the caller cannot supply.

Codex's review flow is the concrete casualty. A review runs as a delegated sub-Codex with approval_policy pinned to Never, its delegate event forwarder has no arm for ElicitationRequest, and the elicitation await has no timeout — so the first secall call inside codex review is announced (mcp: secall/recall started) and then never dispatched. The tools/call frame never reaches this server and the run waits forever. Upstream: openai/codex#31565 (open).

Measured

Three codex exec review runs against a mock MCP server that mirrors this server's wire behaviour — same binary, same prompt, same repo:

sandbox annotations tools/call reached the server outcome
A read-only none never hung, killed at 600s
B danger-full-access none yes, 75.5s completed, 66s
C read-only read-only hints yes, 14.6s completed, 22s

And against this server before the change, under codex exec review -c sandbox_mode=read-only: mcp: secall/recall started, then 480s of silence until the timeout killed it.

The daemon itself was never at fault — verified separately that it reaps idle sessions at exactly 300s, closes the standalone SSE stream cleanly, and answers a reaped session id with 404 in 0.4ms, which is what MCP requires.

Change

read_only_hint = true, destructive_hint = false, idempotent_hint = true, open_world_hint = false on recall, get, status, wiki_search and graph_query, plus a title each. All five only read the local index, so the annotations are accurate on their own merits; unblocking that client is the reason to add them now.

Tests: cargo test --no-default-features -p secall-core — 121 passed, 0 failed, 8 ignored.

Every tool in the MCP router reads the local index and mutates nothing,
but none of them said so. An MCP client that sees no annotations must
assume the tool is destructive and open-world, and some clients then
demand an approval the caller cannot supply.

Codex's review flow is the concrete casualty: a review runs as a
delegated sub-Codex with approval_policy pinned to Never, its elicitation
handler has no arm for ElicitationRequest, and the await has no timeout.
The result is that the first secall call in `codex review` is announced
and then never dispatched -- the tools/call frame never reaches the
server and the run waits forever (openai/codex#31565, unfixed).

Measured, same binary and prompt, only the annotations differing:
un-annotated hung past 600s with no tools/call reaching the server;
annotated dispatched in 14.6s and completed in 22s.

The annotations are accurate on their own merits; unblocking that client
is the reason to add them now.
@khanrc
khanrc merged commit e0f0ad8 into main Jul 27, 2026
@khanrc
khanrc deleted the gh-1755-tool-annotations branch July 27, 2026 10:49
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.

2 participants