diff --git a/packages/cli/src/mcpserver.ts b/packages/cli/src/mcpserver.ts index 6fb0273602..38990f764b 100644 --- a/packages/cli/src/mcpserver.ts +++ b/packages/cli/src/mcpserver.ts @@ -78,7 +78,14 @@ export async function startMcpServer( dbg(`fetching scripts from watcher`) const scripts = await watcher.scripts() const tools = scripts.map((script) => { - const { id, title, description, inputSchema, accept } = script + const { + id, + title, + description, + inputSchema, + accept, + annotations = {}, + } = script const scriptSchema = (inputSchema?.properties .script as JSONSchemaObject) || { type: "object", @@ -94,9 +101,13 @@ export async function startMcpServer( } return { name: id, - description: toStringList(title, description), + description, inputSchema: scriptSchema as ListToolsResult["tools"][0]["inputSchema"], + annotations: { + ...annotations, + title, + }, } satisfies ListToolsResult["tools"][0] }) dbg(`returning tool list with ${tools.length} tools`) diff --git a/packages/core/src/types/prompt_template.d.ts b/packages/core/src/types/prompt_template.d.ts index c57ab065d2..8bc70b0776 100644 --- a/packages/core/src/types/prompt_template.d.ts +++ b/packages/core/src/types/prompt_template.d.ts @@ -752,6 +752,31 @@ interface ModelTemplateOptions extends FenceFormatOptions { flexTokens?: number } +interface McpToolAnnotations { + /** + * Annotations for MCP tools + * @link https://modelcontextprotocol.io/docs/concepts/tools#available-tool-annotations + */ + annotations?: { + /** + * If true, indicates the tool does not modify its environment + */ + readOnlyHint?: boolean + /** + * If true, the tool may perform destructive updates (only meaningful when readOnlyHint is false) + */ + destructiveHint?: boolean + /** + * If true, calling the tool repeatedly with the same arguments has no additional effect (only meaningful when readOnlyHint is false) + */ + idempotentHint?: boolean + /** + * If true, the tool may interact with an “open world” of external entities + */ + openWorldHint?: boolean + } +} + interface PromptScript extends PromptLike, ModelOptions, @@ -761,7 +786,8 @@ interface PromptScript ContentSafetyOptions, SecretDetectionOptions, GitIgnoreFilterOptions, - ScriptRuntimeOptions { + ScriptRuntimeOptions, + McpToolAnnotations { /** * Which provider to prefer when picking a model. */