Files
mcp/test/annotations.test.ts
zeekay 5b108f9625
Hanzo CI/CD / test (linux-amd64) (push) Skipped
Hanzo CI/CD / test (linux-arm64) (push) Skipped
Hanzo CI/CD / test-advisory (push) Skipped
publish / publish (push) Failing after 3m18s
Hanzo CI/CD / test-amd64 (push) Failing after 6m31s
Hanzo CI/CD / cicd (push) Skipped
CI/CD / cicd (push) Failing after 6m33s
@hanzo/mcp 2.4.21: read-only tools say so
The same annotation hanzo-mcp 1.1.31 gives its tools: every Kai decision
tool, llm, think and code_search/context/ask are listed with readOnlyHint,
so Codex and its forks call them in a run that never asks.

Claude-Session: https://claude.ai/code/session_01M8RoubcPN71KgJuZ8LdBUL
2026-10-15 03:29:50 -07:00

20 lines
998 B
TypeScript

import { describe, expect, it } from '@jest/globals';
import { READ_ONLY, listed } from '../src/types/index.js';
import { kaiTools, kaiAgentTools, kaiPurposeBuiltTools } from '../src/tools/kai.js';
// A client that asks before any tool that may write (Codex, by default) refuses every unannotated
// call in a run that never asks, so a tool that only reads or decides must say so.
describe('tool annotations', () => {
it('lists every Kai decision tool as read-only', () => {
for (const tool of [...kaiTools, ...kaiAgentTools, ...kaiPurposeBuiltTools]) {
expect(READ_ONLY.has(tool.name)).toBe(true);
expect(listed(tool).annotations).toEqual({ readOnlyHint: true, openWorldHint: true });
}
});
it('claims nothing for a tool that may write', () => {
const exec = { name: 'exec', description: 'run', inputSchema: { type: 'object' as const, properties: {} }, handler: async () => ({ content: [] }) };
expect(listed(exec)).not.toHaveProperty('annotations');
});
});