MCPcopy Index your code
hub / github.com/simstudioai/sim / toCustomToolDefinition

Function toCustomToolDefinition

apps/sim/tools/utils.server.ts:31–50  ·  view source on GitHub ↗
(customTool: CustomToolRow)

Source from the content-addressed store, hash-verified

29type CustomToolRow = NonNullable<Awaited<ReturnType<typeof getCustomToolByIdOrTitle>>>
30
31function toCustomToolDefinition(customTool: CustomToolRow): CustomToolDefinition | null {
32 const parsedSchema = customToolSchemaSchema.safeParse(customTool.schema)
33 if (!parsedSchema.success) {
34 logger.error(`Invalid custom tool schema: ${customTool.id}`, {
35 issues: parsedSchema.error.issues,
36 })
37 return null
38 }
39
40 return {
41 id: customTool.id,
42 workspaceId: customTool.workspaceId,
43 userId: customTool.userId,
44 title: customTool.title,
45 schema: parsedSchema.data,
46 code: customTool.code,
47 createdAt: customTool.createdAt.toISOString(),
48 updatedAt: customTool.updatedAt?.toISOString(),
49 }
50}
51
52/**
53 * Execute the actual request and transform the response.

Callers 1

fetchCustomToolFromDBFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected