Skip to content

Commit da144ab

Browse files
committed
ui improvements
1 parent 8489dd5 commit da144ab

5 files changed

Lines changed: 166 additions & 209 deletions

File tree

apps/sim/app/api/mcp/serve/[serverId]/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,18 @@ async function handleToolsList(id: RequestId, serverId: string): Promise<NextRes
170170

171171
const result: ListToolsResult = {
172172
tools: tools.map((tool) => {
173-
const schema = tool.parameterSchema as { properties?: Record<string, unknown> } | null
173+
const schema = tool.parameterSchema as {
174+
type?: string
175+
properties?: Record<string, unknown>
176+
required?: string[]
177+
} | null
174178
return {
175179
name: tool.toolName,
176180
description: tool.toolDescription || `Execute workflow: ${tool.toolName}`,
177181
inputSchema: {
178182
type: 'object' as const,
179183
properties: schema?.properties || {},
184+
...(schema?.required && schema.required.length > 0 && { required: schema.required }),
180185
},
181186
}
182187
}),

apps/sim/app/api/mcp/workflow-servers/[id]/tools/[toolId]/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { NextRequest } from 'next/server'
55
import { createLogger } from '@/lib/logs/console/logger'
66
import { getParsedBody, withMcpAuth } from '@/lib/mcp/middleware'
77
import { createMcpErrorResponse, createMcpSuccessResponse } from '@/lib/mcp/utils'
8+
import { sanitizeToolName } from '@/lib/mcp/workflow-tool-schema'
89

910
const logger = createLogger('WorkflowMcpToolAPI')
1011

@@ -99,7 +100,7 @@ export const PATCH = withMcpAuth<RouteParams>('write')(
99100
}
100101

101102
if (body.toolName !== undefined) {
102-
updateData.toolName = body.toolName.trim()
103+
updateData.toolName = sanitizeToolName(body.toolName)
103104
}
104105
if (body.toolDescription !== undefined) {
105106
updateData.toolDescription = body.toolDescription?.trim() || null

apps/sim/app/api/mcp/workflow-servers/[id]/tools/route.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ export const POST = withMcpAuth<RouteParams>('write')(
184184
)
185185
}
186186

187-
// Generate tool name and description
188-
const toolName = body.toolName?.trim() || sanitizeToolName(workflowRecord.name)
187+
const toolName = sanitizeToolName(body.toolName?.trim() || workflowRecord.name)
189188
const toolDescription =
190189
body.toolDescription?.trim() ||
191190
workflowRecord.description ||

0 commit comments

Comments
 (0)