Skip to content

Commit 472c8c6

Browse files
web-flowclaude
authored andcommitted
feat: Add MCP tool annotations to all tools
Add readOnlyHint, destructiveHint, and title annotations to all 66 tools across 13 workflows to help LLMs better understand tool behavior. Changes: - Update PluginMeta interface to include optional annotations field - Modify tool-registry.ts to pass annotations to SDK registration - Add annotations to all tool definition files: - device (7 tools): build, get_app_path, install, launch, list, stop, test - simulator (12 tools): boot, build, build_run, get_app_path, install, launch, launch_logs, list, open, record, stop, test - simulator-management (5 tools): erase, reset_location, set_appearance, set_location, statusbar - macos (6 tools): build, build_run, get_app_path, launch, stop, test - swift-package (6 tools): build, clean, list, run, stop, test - logging (4 tools): start_device, start_sim, stop_device, stop_sim - ui-testing (11 tools): button, describe_ui, gesture, key_press, key_sequence, long_press, screenshot, swipe, tap, touch, type_text - discovery (1 tool): discover_tools - doctor (1 tool): doctor - project-discovery (5 tools): discover_projs, get_app_bundle_id, get_mac_bundle_id, list_schemes, show_build_settings - project-scaffolding (2 tools): scaffold_ios, scaffold_macos - session-management (3 tools): clear_defaults, set_defaults, show_defaults - utilities (1 tool): clean Annotation guidelines: - readOnlyHint: true for tools that only read/query information - destructiveHint: true for tools that modify state, create/delete files, or execute builds - title: Human-readable name for the tool 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c30fe1b commit 472c8c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+261
-0
lines changed

src/core/plugin-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { z } from 'zod';
2+
import { ToolAnnotations } from '@camsoft/mcp-sdk/types.js';
23
import { ToolResponse } from '../types/common.ts';
34

45
export interface PluginMeta {
56
readonly name: string; // Verb used by MCP
67
readonly schema: Record<string, z.ZodTypeAny>; // Zod validation schema (object schema)
78
readonly description?: string; // One-liner shown in help
9+
readonly annotations?: ToolAnnotations; // MCP tool annotations for LLM behavior hints
810
handler(params: Record<string, unknown>): Promise<ToolResponse>;
911
}
1012

src/mcp/tools/device/build_device.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export default {
7878
sessionAware: publicSchemaObject,
7979
legacy: baseSchemaObject,
8080
}),
81+
annotations: {
82+
title: 'Build Device',
83+
destructiveHint: true,
84+
},
8185
handler: createSessionAwareTool<BuildDeviceParams>({
8286
internalSchema: buildDeviceSchema as unknown as z.ZodType<BuildDeviceParams>,
8387
logicFunction: buildDeviceLogic,

src/mcp/tools/device/get_device_app_path.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ export default {
161161
sessionAware: publicSchemaObject,
162162
legacy: baseSchemaObject,
163163
}),
164+
annotations: {
165+
title: 'Get Device App Path',
166+
readOnlyHint: true,
167+
},
164168
handler: createSessionAwareTool<GetDeviceAppPathParams>({
165169
internalSchema: getDeviceAppPathSchema as unknown as z.ZodType<GetDeviceAppPathParams>,
166170
logicFunction: get_device_app_pathLogic,

src/mcp/tools/device/install_app_device.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ export default {
9292
sessionAware: publicSchemaObject,
9393
legacy: installAppDeviceSchema,
9494
}),
95+
annotations: {
96+
title: 'Install App Device',
97+
destructiveHint: true,
98+
},
9599
handler: createSessionAwareTool<InstallAppDeviceParams>({
96100
internalSchema: installAppDeviceSchema as unknown as z.ZodType<InstallAppDeviceParams>,
97101
logicFunction: install_app_deviceLogic,

src/mcp/tools/device/launch_app_device.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ export default {
151151
sessionAware: publicSchemaObject,
152152
legacy: launchAppDeviceSchema,
153153
}),
154+
annotations: {
155+
title: 'Launch App Device',
156+
destructiveHint: true,
157+
},
154158
handler: createSessionAwareTool<LaunchAppDeviceParams>({
155159
internalSchema: launchAppDeviceSchema as unknown as z.ZodType<LaunchAppDeviceParams>,
156160
logicFunction: launch_app_deviceLogic,

src/mcp/tools/device/list_devices.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,5 +431,9 @@ export default {
431431
description:
432432
'Lists connected physical Apple devices (iPhone, iPad, Apple Watch, Apple TV, Apple Vision Pro) with their UUIDs, names, and connection status. Use this to discover physical devices for testing.',
433433
schema: listDevicesSchema.shape, // MCP SDK compatibility
434+
annotations: {
435+
title: 'List Devices',
436+
readOnlyHint: true,
437+
},
434438
handler: createTypedTool(listDevicesSchema, list_devicesLogic, getDefaultCommandExecutor),
435439
};

src/mcp/tools/device/stop_app_device.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export default {
9494
sessionAware: publicSchemaObject,
9595
legacy: stopAppDeviceSchema,
9696
}),
97+
annotations: {
98+
title: 'Stop App Device',
99+
destructiveHint: true,
100+
},
97101
handler: createSessionAwareTool<StopAppDeviceParams>({
98102
internalSchema: stopAppDeviceSchema as unknown as z.ZodType<StopAppDeviceParams>,
99103
logicFunction: stop_app_deviceLogic,

src/mcp/tools/device/test_device.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ export default {
291291
sessionAware: publicSchemaObject,
292292
legacy: baseSchemaObject,
293293
}),
294+
annotations: {
295+
title: 'Test Device',
296+
destructiveHint: true,
297+
},
294298
handler: createSessionAwareTool<TestDeviceParams>({
295299
internalSchema: testDeviceSchema as unknown as z.ZodType<TestDeviceParams>,
296300
logicFunction: (params: TestDeviceParams, executor: CommandExecutor) =>

src/mcp/tools/discovery/discover_tools.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ export default {
384384
description:
385385
'Analyzes a natural language task description and enables the most relevant development workflow. Prioritizes project/workspace workflows (simulator/device/macOS) and also supports task-based workflows (simulator-management, logging) and Swift packages.',
386386
schema: discoverToolsSchema.shape, // MCP SDK compatibility
387+
annotations: {
388+
title: 'Discover Tools',
389+
readOnlyHint: true,
390+
},
387391
handler: createTypedTool(
388392
discoverToolsSchema,
389393
(params: DiscoverToolsParams, executor) => {

src/mcp/tools/doctor/doctor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ export default {
273273
description:
274274
'Provides comprehensive information about the MCP server environment, available dependencies, and configuration status.',
275275
schema: doctorSchema.shape, // MCP SDK compatibility
276+
annotations: {
277+
title: 'Doctor',
278+
readOnlyHint: true,
279+
},
276280
handler: createTypedTool(doctorSchema, doctorMcpHandler, getDefaultCommandExecutor),
277281
};
278282

0 commit comments

Comments
 (0)