From 4d7fce883e3d27c6ba499d270c04e620cf1c408c Mon Sep 17 00:00:00 2001 From: hmmhmmhm Date: Thu, 3 Dec 2026 13:26:56 +0900 Subject: [PATCH] Expose MCP tool safety annotations --- src/core/compact/server.ts | 5 +++++ tests/core/compact/server.test.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/core/compact/server.ts b/src/core/compact/server.ts index 0615f540..a8130327 100644 --- a/src/core/compact/server.ts +++ b/src/core/compact/server.ts @@ -37,6 +37,11 @@ export function applyCompactTools(server: McpServer, registry: ServiceRegistry): name: tool.name, title: tool.metadata.title, description: tool.metadata.description, + annotations: { + readOnlyHint: tool.name !== 'submit_request', + destructiveHint: false, + openWorldHint: true, + }, inputSchema: z.toJSONSchema(z.object(tool.metadata.inputSchema).strict(), { io: 'input', target: 'draft-7', diff --git a/tests/core/compact/server.test.ts b/tests/core/compact/server.test.ts index 2fd3e896..9e325b09 100644 --- a/tests/core/compact/server.test.ts +++ b/tests/core/compact/server.test.ts @@ -42,6 +42,13 @@ describe('실제 MCP 프로토콜 10개 목록과 deprecated 호환', () => { expect(list.tools.map((t) => t.name)).toEqual([...PUBLIC_TOOL_NAMES]); expect(list.nextCursor).toBeUndefined(); expect(list.tools.every((t) => t.inputSchema.type === 'object')).toBe(true); + for (const tool of list.tools) { + expect(tool.annotations).toMatchObject({ + readOnlyHint: tool.name !== 'submit_request', + destructiveHint: false, + openWorldHint: true, + }); + } const modern = await client.callTool({ name: 'search_products', arguments: { service: 'daiso', query: '테ープ' },