Skip to content

Commit 2f50f9f

Browse files
web-flowclaude
andcommitted
feat: Add tool annotations for improved LLM tool understanding
Add readOnlyHint and destructiveHint annotations to all tools to help LLMs better understand tool behavior and make safer decisions. Changes: - Added readOnlyHint: true to 9 read-only tools (get_component, get_component_demo, list_components, get_component_metadata, get_directory_structure, get_block, list_blocks, list_themes, get_theme) - Added destructiveHint: true to apply_theme (modifies filesystem) - Added title annotations for human-readable display This improves tool safety metadata for MCP clients. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 55a81d1 commit 2f50f9f

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/server/handler.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ export const setupHandlers = (server: Server): void => {
111111
},
112112
required: ['componentName'],
113113
},
114+
annotations: {
115+
title: "Get Component",
116+
readOnlyHint: true,
117+
},
114118
},
115119
{
116120
name: 'get_component_demo',
@@ -125,6 +129,10 @@ export const setupHandlers = (server: Server): void => {
125129
},
126130
required: ['componentName'],
127131
},
132+
annotations: {
133+
title: "Get Component Demo",
134+
readOnlyHint: true,
135+
},
128136
},
129137
{
130138
name: 'list_components',
@@ -133,6 +141,10 @@ export const setupHandlers = (server: Server): void => {
133141
type: 'object',
134142
properties: {},
135143
},
144+
annotations: {
145+
title: "List Components",
146+
readOnlyHint: true,
147+
},
136148
},
137149
{
138150
name: 'get_component_metadata',
@@ -147,6 +159,10 @@ export const setupHandlers = (server: Server): void => {
147159
},
148160
required: ['componentName'],
149161
},
162+
annotations: {
163+
title: "Get Component Metadata",
164+
readOnlyHint: true,
165+
},
150166
},
151167
{
152168
name: 'get_directory_structure',
@@ -172,6 +188,10 @@ export const setupHandlers = (server: Server): void => {
172188
},
173189
},
174190
},
191+
annotations: {
192+
title: "Get Directory Structure",
193+
readOnlyHint: true,
194+
},
175195
},
176196
{
177197
name: 'get_block',
@@ -190,6 +210,10 @@ export const setupHandlers = (server: Server): void => {
190210
},
191211
required: ['blockName'],
192212
},
213+
annotations: {
214+
title: "Get Block",
215+
readOnlyHint: true,
216+
},
193217
},
194218
{
195219
name: 'list_blocks',
@@ -203,6 +227,10 @@ export const setupHandlers = (server: Server): void => {
203227
},
204228
},
205229
},
230+
annotations: {
231+
title: "List Blocks",
232+
readOnlyHint: true,
233+
},
206234
},
207235
{
208236
name: 'apply_theme',
@@ -229,6 +257,10 @@ export const setupHandlers = (server: Server): void => {
229257
},
230258
},
231259
},
260+
annotations: {
261+
title: "Apply Theme",
262+
destructiveHint: true,
263+
},
232264
},
233265
{
234266
name: 'list_themes',
@@ -237,6 +269,10 @@ export const setupHandlers = (server: Server): void => {
237269
type: 'object',
238270
properties: {},
239271
},
272+
annotations: {
273+
title: "List Themes",
274+
readOnlyHint: true,
275+
},
240276
},
241277
{
242278
name: 'get_theme',
@@ -251,6 +287,10 @@ export const setupHandlers = (server: Server): void => {
251287
},
252288
required: ['themeName'],
253289
},
290+
annotations: {
291+
title: "Get Theme",
292+
readOnlyHint: true,
293+
},
254294
},
255295
];
256296

0 commit comments

Comments
 (0)