/** * mcpNaming —— 通用 MCP 工具命名工具(与卡片无关)。 * * MCP 工具有双重身份(见 {@link IAgentToolDescriptor}):`name` 是 server 内原始工具名 * (供 `callTool` 路由与卡片 resolver 按 resourceId+toolName 匹配),`modelName` 是 * 暴露给 LLM 的稳定名。不同 MCP server(不同 resourceId)可能有同名工具(都叫 `get`), * 故 `modelName` 需编码 resourceId 命名空间以跨 server 唯一。 * * 命名格式 `mcp_<可读片段>_`:`resourceId__toolName` 经 sanitize 后取 * ≤38 字符可读前缀,再拼 sha256 摘要兜底碰撞/非法字符,保证 LLM 可见名确定且稳定。 * 卡片专属命名(前缀 `a2ui_card`)留在 cardTools,仅本文件提供底层 stableToolName。 */ import type { IAgentToolDescriptor } from './ports.js'; /** 用 resourceId + toolName 生成 MCP 工具暴露给 LLM 的稳定命名空间名。 */ export declare function createNamespacedMcpToolName(resourceId: string, toolName: string): string; /** * 为一组 MCP 工具设置 `modelName`(resourceId 命名空间隔离 + 去重)。 * * 每个 tool 必须带 `resourceId`(缺失抛错);`modelName` 重复抛错——真撞名时 LLM * 无法消歧,应前置报错而非静默。`name` 原样保留,供 `callTool` 与卡片 resolver 路由。 */ export declare function namespaceMcpTools(tools: IAgentToolDescriptor[]): IAgentToolDescriptor[]; /** * 稳定工具名:`_<可读片段>_`。 * * 非法字符 `[A-Za-z0-9_-]` 之外替成 `_`,去首尾下划线后取 ≤38 字符(空则用 * `resource` 兜底);拼接 raw 的 sha256 前 10 位兜底碰撞与非法字符,保证确定且稳定。 */ export declare function stableToolName(prefix: string, raw: string): string;