Skip to content

Commit ee5646c

Browse files
authored
fix(mcp): declare request bodies and annotation titles (#8827)
1 parent 146be34 commit ee5646c

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

‎apps/sim/lib/api/mcp/server.ts‎

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ const callInput = z
6666
.record(z.string(), z.string())
6767
.optional()
6868
.describe('Request headers the operation declares, such as upload-token.'),
69-
body: z.unknown().optional().describe('JSON request body, as describe_operation specifies.'),
69+
body: z
70+
.record(z.string(), z.unknown())
71+
.meta({ additionalProperties: true })
72+
.optional()
73+
.describe('JSON request body, as describe_operation specifies.'),
7074
})
7175
.strict()
7276

@@ -109,7 +113,12 @@ export function createSimMcpServer(context: Omit<McpDispatchContext, 'signal'>):
109113
description:
110114
'Find Sim API operations by keyword or domain. Returns each operation’s name, HTTP method, path, summary, and the tool that runs it. Call without a query to list a domain.',
111115
inputSchema: searchInput,
112-
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
116+
annotations: {
117+
title: 'Search operations',
118+
readOnlyHint: true,
119+
idempotentHint: true,
120+
openWorldHint: false,
121+
},
113122
},
114123
async (input) => jsonToolResult(await searchOperations(input))
115124
)
@@ -121,7 +130,12 @@ export function createSimMcpServer(context: Omit<McpDispatchContext, 'signal'>):
121130
description:
122131
'Get the JSON Schema of an operation’s path parameters, query, body, and headers. Read it before calling an operation for the first time.',
123132
inputSchema: describeInput,
124-
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
133+
annotations: {
134+
title: 'Describe operation',
135+
readOnlyHint: true,
136+
idempotentHint: true,
137+
openWorldHint: false,
138+
},
125139
},
126140
async ({ operation }) => {
127141
const resolved = await resolveOperation(operation, 'any')
@@ -138,7 +152,12 @@ export function createSimMcpServer(context: Omit<McpDispatchContext, 'signal'>):
138152
description:
139153
'Run a Sim API operation that only reads, such as listWorkspaces, listTables, queryRows, or getWorkflowRun. search_operations says which tool runs each operation.',
140154
inputSchema: callInput,
141-
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
155+
annotations: {
156+
title: 'Read from Sim',
157+
readOnlyHint: true,
158+
idempotentHint: true,
159+
openWorldHint: false,
160+
},
142161
},
143162
async (input, extra) => call('read', input, extra.signal)
144163
)
@@ -151,6 +170,7 @@ export function createSimMcpServer(context: Omit<McpDispatchContext, 'signal'>):
151170
'Run a Sim API operation that creates, changes, runs, or deletes something, such as createTable, executeWorkflow, or deleteFile.',
152171
inputSchema: callInput,
153172
annotations: {
173+
title: 'Change Sim',
154174
readOnlyHint: false,
155175
destructiveHint: true,
156176
idempotentHint: false,

0 commit comments

Comments
 (0)