Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/cli/src/mcpserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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`)
Expand Down
28 changes: 27 additions & 1 deletion packages/core/src/types/prompt_template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -761,7 +786,8 @@ interface PromptScript
ContentSafetyOptions,
SecretDetectionOptions,
GitIgnoreFilterOptions,
ScriptRuntimeOptions {
ScriptRuntimeOptions,
McpToolAnnotations {
/**
* Which provider to prefer when picking a model.
*/
Expand Down
Loading