MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / expectReadOnly

Function expectReadOnly

__tests__/mcp-tool-annotations.test.ts:30–38  ·  view source on GitHub ↗

Assert a single tool advertises the full read-only contract from #1018.

(tool: ToolDefinition)

Source from the content-addressed store, hash-verified

28
29/** Assert a single tool advertises the full read-only contract from #1018. */
30function expectReadOnly(tool: ToolDefinition): void {
31 expect(tool.annotations, `${tool.name} is missing annotations`).toBeDefined();
32 // The hint Cursor Ask mode (and other clients) gate on.
33 expect(tool.annotations!.readOnlyHint).toBe(true);
34 // The exact triplet the issue asks for, plus the honest closed-world hint.
35 expect(tool.annotations!.destructiveHint).toBe(false);
36 expect(tool.annotations!.idempotentHint).toBe(true);
37 expect(tool.annotations!.openWorldHint).toBe(false);
38}
39
40/** Assert the explore tool in a `tools/list` surface is marked always-load for Claude Code (#1696). */
41function expectExploreAlwaysLoad(surface: ToolDefinition[]): void {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected