/** * Tool module auto-registration — C-ARCH-01 * * Centralizes all tool module imports and registration in one place. * GodotServer.ts only needs to call registerAllModules(). * * 2026-08-21 架构审查 D-2:从 src/core/ 移到 src/ 根——本文件是应用层组合根(43 个 * tools import),放 core/ 使「core 不依赖 tools」声明名不副实;移出后 eslint 分层门禁 * (core→tools 禁止)不再需要豁免条目。 * * CMP-13 (2026-08-09): ALL_MODULES 数组由 scripts/generate-all-modules.mjs * 自动生成(从下方 import 块提取别名)。新增工具:① 加 import 行 ② 跑 * `npm run generate:modules` 重生成数组。勿手动编辑 ALL_MODULES 数组。 */ import { type RiskLevel } from './core/tool-registry.js'; import type { Tool } from "@modelcontextprotocol/server"; /** * Derive MCP-standard ToolAnnotations hints from a tool's actionRisks. * * Maps the project's internal RiskLevel taxonomy (read/write/destructive/process) * to the four MCP-standard hints (spec 2025-06-18). Clients use these to decide * whether to prompt for user confirmation before executing the tool. * * Rules (conservative — never over-claim safety): * - readOnlyHint: true only if every action is 'read' * - destructiveHint: true if any action is 'destructive' * - idempotentHint: true if readOnly OR pure-write(idempotent 的定义是「多次执行结果一致/重试安全」。 * 纯读无副作用 ⇒ 幂等;纯写(全部 write,无 destructive/process)覆盖/设置/创建同值 * 结果一致,重试不放大副作用,亦判幂等。混合 read+write 的工具因 merged action * 模式无法整体判定(如 save_scene 幂等但 create_node 不幂等),保守 false。 * destructive(删除不可重试)与 process(执行副作用不可逆)一律 false。 * readOnly 是 idempotent 的充分条件而非定义) * - openWorldHint: omitted (tools operate on Godot's closed world; default false) * * Tools without actionRisks default to write semantics (readOnlyHint=false), * matching the registry's default readonly=false for untagged tools (A-10). */ export declare function deriveMcpHints(actionRisks?: Record): { readOnlyHint: boolean; destructiveHint: boolean; idempotentHint: boolean; }; export declare const SLIM_THRESHOLD_BYTES = 8000; export declare const SLIM_CONFIG: Record; /** * 对超阈值的工具瘦身:移除 action 专属参数,追加 description 提示。 * 幂等:已瘦身的工具(无配置或未超阈值)原样返回。 */ export declare function slimSchema(defs: Tool[]): Tool[]; /** Register all tool modules into the global registry. Idempotent — safe to call multiple times. */ export declare function registerAllModules(): void;