Skip to content

Commit c45ad4b

Browse files
committed
feat(mcp): add tool annotations for Connectors Directory compliance
1 parent 28e13b7 commit c45ad4b

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

apps/sim/app/api/mcp/copilot/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,14 @@ function buildMcpServer(abortSignal?: AbortSignal): Server {
385385
name: tool.name,
386386
description: tool.description,
387387
inputSchema: tool.inputSchema,
388+
...(tool.annotations && { annotations: tool.annotations }),
388389
}))
389390

390391
const subagentTools = SUBAGENT_TOOL_DEFS.map((tool) => ({
391392
name: tool.name,
392393
description: tool.description,
393394
inputSchema: tool.inputSchema,
395+
...(tool.annotations && { annotations: tool.annotations }),
394396
}))
395397

396398
const result: ListToolsResult = {

apps/sim/lib/copilot/tools/mcp/definitions.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1+
export type ToolAnnotations = {
2+
readOnlyHint?: boolean
3+
destructiveHint?: boolean
4+
idempotentHint?: boolean
5+
openWorldHint?: boolean
6+
}
7+
18
export type DirectToolDef = {
29
name: string
310
description: string
411
inputSchema: { type: 'object'; properties?: Record<string, unknown>; required?: string[] }
512
toolId: string
13+
annotations?: ToolAnnotations
614
}
715

816
export type SubagentToolDef = {
917
name: string
1018
description: string
1119
inputSchema: { type: 'object'; properties?: Record<string, unknown>; required?: string[] }
1220
agentId: string
21+
annotations?: ToolAnnotations
1322
}
1423

1524
/**
@@ -26,6 +35,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
2635
type: 'object',
2736
properties: {},
2837
},
38+
annotations: { readOnlyHint: true },
2939
},
3040
{
3141
name: 'list_workflows',
@@ -45,6 +55,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
4555
},
4656
},
4757
},
58+
annotations: { readOnlyHint: true },
4859
},
4960
{
5061
name: 'list_folders',
@@ -61,6 +72,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
6172
},
6273
required: ['workspaceId'],
6374
},
75+
annotations: { readOnlyHint: true },
6476
},
6577
{
6678
name: 'get_workflow',
@@ -77,6 +89,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
7789
},
7890
required: ['workflowId'],
7991
},
92+
annotations: { readOnlyHint: true },
8093
},
8194
{
8295
name: 'create_workflow',
@@ -105,6 +118,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
105118
},
106119
required: ['name'],
107120
},
121+
annotations: { destructiveHint: false },
108122
},
109123
{
110124
name: 'create_folder',
@@ -129,6 +143,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
129143
},
130144
required: ['name'],
131145
},
146+
annotations: { destructiveHint: false },
132147
},
133148
{
134149
name: 'rename_workflow',
@@ -148,6 +163,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
148163
},
149164
required: ['workflowId', 'name'],
150165
},
166+
annotations: { destructiveHint: false, idempotentHint: true },
151167
},
152168
{
153169
name: 'move_workflow',
@@ -168,6 +184,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
168184
},
169185
required: ['workflowId'],
170186
},
187+
annotations: { destructiveHint: false, idempotentHint: true },
171188
},
172189
{
173190
name: 'move_folder',
@@ -189,6 +206,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
189206
},
190207
required: ['folderId'],
191208
},
209+
annotations: { destructiveHint: false, idempotentHint: true },
192210
},
193211
{
194212
name: 'run_workflow',
@@ -214,6 +232,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
214232
},
215233
required: ['workflowId'],
216234
},
235+
annotations: { destructiveHint: false, openWorldHint: true },
217236
},
218237
{
219238
name: 'run_workflow_until_block',
@@ -243,6 +262,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
243262
},
244263
required: ['workflowId', 'stopAfterBlockId'],
245264
},
265+
annotations: { destructiveHint: false, openWorldHint: true },
246266
},
247267
{
248268
name: 'run_from_block',
@@ -276,6 +296,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
276296
},
277297
required: ['workflowId', 'startBlockId'],
278298
},
299+
annotations: { destructiveHint: false, openWorldHint: true },
279300
},
280301
{
281302
name: 'run_block',
@@ -309,6 +330,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
309330
},
310331
required: ['workflowId', 'blockId'],
311332
},
333+
annotations: { destructiveHint: false, openWorldHint: true },
312334
},
313335
{
314336
name: 'get_deployed_workflow_state',
@@ -325,6 +347,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
325347
},
326348
required: ['workflowId'],
327349
},
350+
annotations: { readOnlyHint: true },
328351
},
329352
{
330353
name: 'generate_api_key',
@@ -346,6 +369,7 @@ export const DIRECT_TOOL_DEFS: DirectToolDef[] = [
346369
},
347370
required: ['name'],
348371
},
372+
annotations: { destructiveHint: false },
349373
},
350374
]
351375

@@ -397,6 +421,7 @@ WORKFLOW:
397421
},
398422
required: ['request', 'workflowId'],
399423
},
424+
annotations: { destructiveHint: false, openWorldHint: true },
400425
},
401426
{
402427
name: 'sim_discovery',
@@ -422,6 +447,7 @@ DO NOT USE (use direct tools instead):
422447
},
423448
required: ['request'],
424449
},
450+
annotations: { readOnlyHint: true },
425451
},
426452
{
427453
name: 'sim_plan',
@@ -456,6 +482,7 @@ IMPORTANT: Pass the returned plan EXACTLY to sim_edit - do not modify or summari
456482
},
457483
required: ['request', 'workflowId'],
458484
},
485+
annotations: { readOnlyHint: true },
459486
},
460487
{
461488
name: 'sim_edit',
@@ -491,6 +518,7 @@ After sim_edit completes, you can test immediately with sim_test, or deploy with
491518
},
492519
required: ['workflowId'],
493520
},
521+
annotations: { destructiveHint: false, openWorldHint: true },
494522
},
495523
{
496524
name: 'sim_deploy',
@@ -524,6 +552,7 @@ ALSO CAN:
524552
},
525553
required: ['request', 'workflowId'],
526554
},
555+
annotations: { destructiveHint: false, openWorldHint: true },
527556
},
528557
{
529558
name: 'sim_test',
@@ -547,6 +576,7 @@ Supports full and partial execution:
547576
},
548577
required: ['request', 'workflowId'],
549578
},
579+
annotations: { destructiveHint: false, openWorldHint: true },
550580
},
551581
{
552582
name: 'sim_debug',
@@ -562,6 +592,7 @@ Supports full and partial execution:
562592
},
563593
required: ['error', 'workflowId'],
564594
},
595+
annotations: { readOnlyHint: true },
565596
},
566597
{
567598
name: 'sim_auth',
@@ -576,6 +607,7 @@ Supports full and partial execution:
576607
},
577608
required: ['request'],
578609
},
610+
annotations: { destructiveHint: false, openWorldHint: true },
579611
},
580612
{
581613
name: 'sim_knowledge',
@@ -590,6 +622,7 @@ Supports full and partial execution:
590622
},
591623
required: ['request'],
592624
},
625+
annotations: { destructiveHint: false },
593626
},
594627
{
595628
name: 'sim_custom_tool',
@@ -604,6 +637,7 @@ Supports full and partial execution:
604637
},
605638
required: ['request'],
606639
},
640+
annotations: { destructiveHint: false },
607641
},
608642
{
609643
name: 'sim_info',
@@ -619,6 +653,7 @@ Supports full and partial execution:
619653
},
620654
required: ['request'],
621655
},
656+
annotations: { readOnlyHint: true },
622657
},
623658
{
624659
name: 'sim_workflow',
@@ -634,6 +669,7 @@ Supports full and partial execution:
634669
},
635670
required: ['request'],
636671
},
672+
annotations: { destructiveHint: false },
637673
},
638674
{
639675
name: 'sim_research',
@@ -648,6 +684,7 @@ Supports full and partial execution:
648684
},
649685
required: ['request'],
650686
},
687+
annotations: { readOnlyHint: true, openWorldHint: true },
651688
},
652689
{
653690
name: 'sim_superagent',
@@ -662,6 +699,7 @@ Supports full and partial execution:
662699
},
663700
required: ['request'],
664701
},
702+
annotations: { destructiveHint: true, openWorldHint: true },
665703
},
666704
{
667705
name: 'sim_platform',
@@ -676,5 +714,6 @@ Supports full and partial execution:
676714
},
677715
required: ['request'],
678716
},
717+
annotations: { readOnlyHint: true },
679718
},
680719
]

0 commit comments

Comments
 (0)