Skip to content

Commit 6161130

Browse files
web-flowclaude
andcommitted
feat(mcp): Add tool annotations for improved LLM tool understanding
Add `readOnlyHint` and `destructiveHint` annotations to all 15 MCP tools to help AI/LLM agents better understand the safety characteristics of each tool: Read-only tools (10): - searchDocsTool - Search documentation - listOrgsTool - List organizations - listProjectsTool - List projects - getCurrentWorker - Get current worker info - listRunsTool - List runs - getRunDetailsTool - Get run details - waitForRunToCompleteTool - Wait for run completion - listDeploysTool - List deployments - listPreviewBranchesTool - List preview branches Destructive tools (5): - createProjectInOrgTool - Creates a new project - initializeProjectTool - Initializes a project - triggerTaskTool - Triggers task execution - cancelRunTool - Cancels a running task - deployTool - Deploys code to environment These annotations follow the MCP specification and help AI agents make informed decisions about which tools require user confirmation before execution. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent edf5b14 commit 6161130

File tree

7 files changed

+33
-1
lines changed

7 files changed

+33
-1
lines changed

packages/cli-v3/src/mcp/tools.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ export function registerTools(context: McpContext) {
3939
context.server.registerTool(
4040
tool.name,
4141
{
42-
annotations: { title: tool.title },
42+
annotations: {
43+
title: tool.title,
44+
readOnlyHint: tool.readOnlyHint,
45+
destructiveHint: tool.destructiveHint,
46+
},
4347
description: tool.description,
4448
inputSchema: tool.inputSchema,
4549
},

packages/cli-v3/src/mcp/tools/deploys.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export const deployTool = {
1414
name: toolsMetadata.deploy.name,
1515
title: toolsMetadata.deploy.title,
1616
description: toolsMetadata.deploy.description,
17+
readOnlyHint: false,
18+
destructiveHint: true,
1719
inputSchema: DeployInput.shape,
1820
handler: toolHandler(DeployInput.shape, async (input, { ctx, createProgressTracker, _meta }) => {
1921
ctx.logger?.log("calling deploy", { input });
@@ -114,6 +116,8 @@ export const listDeploysTool = {
114116
name: toolsMetadata.list_deploys.name,
115117
title: toolsMetadata.list_deploys.title,
116118
description: toolsMetadata.list_deploys.description,
119+
readOnlyHint: true,
120+
destructiveHint: false,
117121
inputSchema: ListDeploysInput.shape,
118122
handler: toolHandler(ListDeploysInput.shape, async (input, { ctx }) => {
119123
ctx.logger?.log("calling list_deploys", { input });

packages/cli-v3/src/mcp/tools/docs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export const searchDocsTool = {
77
name: toolsMetadata.search_docs.name,
88
title: toolsMetadata.search_docs.title,
99
description: toolsMetadata.search_docs.description,
10+
readOnlyHint: true,
11+
destructiveHint: false,
1012
inputSchema: {
1113
query: z.string(),
1214
},

packages/cli-v3/src/mcp/tools/orgs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export const listOrgsTool = {
1111
name: toolsMetadata.list_orgs.name,
1212
title: toolsMetadata.list_orgs.title,
1313
description: toolsMetadata.list_orgs.description,
14+
readOnlyHint: true,
15+
destructiveHint: false,
1416
inputSchema: {},
1517
handler: async (input: unknown, { ctx }: ToolMeta): Promise<CallToolResult> => {
1618
ctx.logger?.log("calling list_orgs", { input });
@@ -39,6 +41,8 @@ export const listProjectsTool = {
3941
name: toolsMetadata.list_projects.name,
4042
title: toolsMetadata.list_projects.title,
4143
description: toolsMetadata.list_projects.description,
44+
readOnlyHint: true,
45+
destructiveHint: false,
4246
inputSchema: {},
4347
handler: async (input: unknown, { ctx }: ToolMeta): Promise<CallToolResult> => {
4448
ctx.logger?.log("calling list_projects", { input });
@@ -107,6 +111,8 @@ export const createProjectInOrgTool = {
107111
name: toolsMetadata.create_project_in_org.name,
108112
title: toolsMetadata.create_project_in_org.title,
109113
description: toolsMetadata.create_project_in_org.description,
114+
readOnlyHint: false,
115+
destructiveHint: true,
110116
inputSchema: CreateProjectInOrgInput.shape,
111117
handler: toolHandler(CreateProjectInOrgInput.shape, async (input, { ctx }) => {
112118
ctx.logger?.log("calling create_project_in_org", { input });
@@ -137,6 +143,8 @@ export const initializeProjectTool = {
137143
name: toolsMetadata.initialize_project.name,
138144
title: toolsMetadata.initialize_project.title,
139145
description: toolsMetadata.initialize_project.description,
146+
readOnlyHint: false,
147+
destructiveHint: true,
140148
inputSchema: InitializeProjectInput.shape,
141149
handler: toolHandler(InitializeProjectInput.shape, async (input, { ctx }) => {
142150
ctx.logger?.log("calling initialize_project", { input });

packages/cli-v3/src/mcp/tools/previewBranches.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export const listPreviewBranchesTool = {
77
name: toolsMetadata.list_preview_branches.name,
88
title: toolsMetadata.list_preview_branches.title,
99
description: toolsMetadata.list_preview_branches.description,
10+
readOnlyHint: true,
11+
destructiveHint: false,
1012
inputSchema: ListPreviewBranchesInput.shape,
1113
handler: toolHandler(ListPreviewBranchesInput.shape, async (input, { ctx }) => {
1214
ctx.logger?.log("calling list_preview_branches", { input });

packages/cli-v3/src/mcp/tools/runs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export const getRunDetailsTool = {
88
name: toolsMetadata.get_run_details.name,
99
title: toolsMetadata.get_run_details.title,
1010
description: toolsMetadata.get_run_details.description,
11+
readOnlyHint: true,
12+
destructiveHint: false,
1113
inputSchema: GetRunDetailsInput.shape,
1214
handler: toolHandler(GetRunDetailsInput.shape, async (input, { ctx }) => {
1315
ctx.logger?.log("calling get_run_details", { input });
@@ -65,6 +67,8 @@ export const waitForRunToCompleteTool = {
6567
name: toolsMetadata.wait_for_run_to_complete.name,
6668
title: toolsMetadata.wait_for_run_to_complete.title,
6769
description: toolsMetadata.wait_for_run_to_complete.description,
70+
readOnlyHint: true,
71+
destructiveHint: false,
6872
inputSchema: CommonRunsInput.shape,
6973
handler: toolHandler(CommonRunsInput.shape, async (input, { ctx, signal }) => {
7074
ctx.logger?.log("calling wait_for_run_to_complete", { input });
@@ -118,6 +122,8 @@ export const cancelRunTool = {
118122
name: toolsMetadata.cancel_run.name,
119123
title: toolsMetadata.cancel_run.title,
120124
description: toolsMetadata.cancel_run.description,
125+
readOnlyHint: false,
126+
destructiveHint: true,
121127
inputSchema: CommonRunsInput.shape,
122128
handler: toolHandler(CommonRunsInput.shape, async (input, { ctx }) => {
123129
ctx.logger?.log("calling cancel_run", { input });
@@ -158,6 +164,8 @@ export const listRunsTool = {
158164
name: toolsMetadata.list_runs.name,
159165
title: toolsMetadata.list_runs.title,
160166
description: toolsMetadata.list_runs.description,
167+
readOnlyHint: true,
168+
destructiveHint: false,
161169
inputSchema: ListRunsInput.shape,
162170
handler: toolHandler(ListRunsInput.shape, async (input, { ctx }) => {
163171
ctx.logger?.log("calling list_runs", { input });

packages/cli-v3/src/mcp/tools/tasks.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export const getCurrentWorker = {
77
name: toolsMetadata.get_current_worker.name,
88
title: toolsMetadata.get_current_worker.title,
99
description: toolsMetadata.get_current_worker.description,
10+
readOnlyHint: true,
11+
destructiveHint: false,
1012
inputSchema: CommonProjectsInput.shape,
1113
handler: toolHandler(CommonProjectsInput.shape, async (input, { ctx }) => {
1214
ctx.logger?.log("calling get_current_worker", { input });
@@ -86,6 +88,8 @@ export const triggerTaskTool = {
8688
name: toolsMetadata.trigger_task.name,
8789
title: toolsMetadata.trigger_task.title,
8890
description: toolsMetadata.trigger_task.description,
91+
readOnlyHint: false,
92+
destructiveHint: true,
8993
inputSchema: TriggerTaskInput.shape,
9094
handler: toolHandler(TriggerTaskInput.shape, async (input, { ctx }) => {
9195
ctx.logger?.log("calling trigger_task", { input });

0 commit comments

Comments
 (0)