import type { Tool, Server } from "@modelcontextprotocol/server"; import type { ToolResult, ToolContext } from '../types.js'; export type RiskLevel = 'read' | 'write' | 'destructive' | 'process'; export interface ToolMeta { name: string; readonly: boolean; long_running: boolean; actionRisks?: Record; } export interface ToolModule { TOOL_META?: Record; }>; getToolDefinitions(): Tool[]; handleTool(toolName: string, args: Record, ctx: ToolContext): Promise; } /** Register a tool module. Called once per module at import time. */ export declare function registerModule(mod: ToolModule): void; /** Register an inline tool's metadata (for tools not in a ToolModule). */ export declare function registerInlineTool(name: string, meta: Omit): void; /** Check whether a tool name is registered in the meta registry. */ export declare function isKnownTool(name: string): boolean; export declare function isReadOnly(name: string): boolean; export declare function isLongRunning(name: string): boolean; export declare function getReadOnlyTools(): string[]; export declare function getWriteTools(): string[]; export declare function getAllToolNames(): string[]; export declare function getToolMeta(name: string): ToolMeta | undefined; export declare function getActionRisks(name: string): Record | undefined; export declare function getActionRisk(toolName: string, action: string): RiskLevel | undefined; export declare function getModuleForTool(name: string): ToolModule | undefined; /** 找某 tool 的定义(含 inputSchema);inline tool(只进 metaRegistry)返 undefined。 */ export declare function getToolDefinition(name: string): Tool | undefined; export declare function getAllToolDefinitions(): Tool[]; export declare function getModules(): readonly ToolModule[]; /** Register tools from flat array (legacy, used by tests). */ export declare function registerTools(tools: ToolMeta[]): void; /** Clear all registered tools and modules (test-only). */ export declare function clearRegistry(): void; /** Tool group definition with connection requirements and protection. */ export interface ToolGroupDef { description: string; tools: string[]; requires: ('bridge' | 'editor' | 'headless')[]; protected?: boolean; } /** Tool groups for fine-grained profile configuration. Count verified by test/tool-groups.test.js (number omitted here to avoid drift as groups are added). */ export declare const TOOL_GROUPS: Record; /** 7 preset profiles. Each maps to an array of group names. */ export declare const PROFILES: Record; /** Expand an array of group names to a deduplicated set of tool names. */ export declare function expandGroups(groups: string[]): Set; /** Resolve a profile name (or comma-separated group list) to a Set of tool names. */ export declare function resolveProfile(profile: string): Set; /** Tools that are always allowed regardless of group state. */ export declare const ALWAYS_ALLOWED: Set; /** Set active groups (copy-on-write). Returns previous set for comparison. */ export declare function setActiveGroups(groups: Set): Set; /** Get current active groups (read-only snapshot). */ export declare function getActiveGroups(): ReadonlySet; /** 注册一批动态工具(live schema 从 editor 拉取后调用)。 * 完全替换之前的动态工具集(增量更新由调用方先 diff 再调)。 * 同时更新 toolToGroup 映射,让 isToolAllowed 放行。 */ export declare function registerDynamicTools(names: string[]): void; /** 获取当前动态注册的工具名集合(只读快照) */ export declare function getDynamicToolNames(): readonly string[]; /** A1 (2026-08-11 审查): 判断某工具名是否动态注册(供 confirm/action-gate 反查静态 risk 用)。 */ export declare function isDynamicToolName(name: string): boolean; /** Check if a tool is allowed under current active groups. */ export declare function isToolAllowed(toolName: string): boolean; /** Get the group name for a tool. Returns undefined if tool not in any group. */ export declare function getGroupForTool(toolName: string): string | undefined; export declare const LITE_TOOLS: Set; export declare const MINIMAL_TOOLS: Set; /** Tools that can run without an active Godot connection. */ export declare const OFFLINE_TOOLS: Set; /** Check if a tool can run in offline mode. */ export declare function isOfflineCapable(toolName: string): boolean; /** Tools that operate globally and should not require project_path. * * 与 ALWAYS_ALLOWED 的交集:manage_tools, confirm_and_execute, godot_advanced_tool * — 这三个工具既是"始终允许"也是"无需项目路径",因它们操作全局注册表/内存状态。 * * 其余 4 个(docs, godot_list_instances, godot_list_dynamic_routes, godot_select_instance) * 不在 ALWAYS_ALLOWED 中(可能被 profile 过滤掉),但同样不操作文件系统。 */ export declare const NO_PROJECT_PATH_TOOLS: Set; /** Check if a tool should skip project_path validation. */ export declare function skipProjectPath(toolName: string): boolean; /** 类型 A — 独立工具吸收的迁移映射。仅 GODOT_MCP_WARN_LEGACY 模式下生效。 */ export declare const LEGACY_TOOL_MAP: Record; /** 尝试将旧工具名映射到新 (tool, action)。仅 WARN_LEGACY 模式下生效。 */ export declare function tryLegacyMapping(toolName: string): { tool: string; action: string; } | null; /** 注入 MCP Server 实例(GodotServer 启动时调用一次)。 */ export declare function setMcpServer(server: Server): void; /** 清理 MCP Server 引用(GodotServer.close 时调用)。 */ export declare function clearMcpServer(): void; /** 通知客户端工具列表已变更。不支持时静默忽略。 */ export declare function notifyToolsChanged(): void;