Skip to content

mcpDeclaredAnnotationLookup

mcpDeclaredAnnotationLookup(declared): (server, toolName) => DeclaredToolAnnotations | undefined

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/approvals/toolAnnotationSources.ts:302

§4.7.1/§4.7.5 — the mcp half of a DeclaredToolAnnotationLookup, over what collectDeclaredMcpToolAnnotations recorded.

UNRESOLVED_MCP_SERVER is refused outright, and that guard is structural rather than belt-and-braces. A call whose server could not be resolved has no identity to look a declaration up by; without the guard the lookup would fall back to string arithmetic on the sentinel and find a declaration in whatever entry happened to reconstruct to the same registered name. “Happened not to collide” is not a security property. Refusing the sentinel makes an unidentifiable call fail-closed for a reason that does not depend on the shape of anyone’s tool names — and, because trust for an unnamed server would otherwise fall through to approvals.mcp.defaults, this is also what stops a permissive defaults from reaching it.

There is one lookup rather than one per call site so the guard cannot be present in the runner and absent in the next consumer.

ReadonlyMap<string, DeclaredToolAnnotations> | undefined

(server, toolName) => DeclaredToolAnnotations | undefined