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

Function createParamSchema

apps/sim/tools/utils.ts:194–223  ·  view source on GitHub ↗
(customTool: any)

Source from the content-addressed store, hash-verified

192 * Creates parameter schema from custom tool schema
193 */
194export function createParamSchema(customTool: any): Record<string, any> {
195 const params: Record<string, any> = {}
196
197 if (customTool.schema.function?.parameters?.properties) {
198 const properties = customTool.schema.function.parameters.properties
199 const required = customTool.schema.function.parameters.required || []
200
201 Object.entries(properties).forEach(([key, config]: [string, any]) => {
202 const isRequired = required.includes(key)
203
204 // Create the base parameter configuration
205 const paramConfig: Record<string, any> = {
206 type: config.type || 'string',
207 required: isRequired,
208 description: config.description || '',
209 }
210
211 // Set visibility based on whether it's required
212 if (isRequired) {
213 paramConfig.visibility = 'user-or-llm'
214 } else {
215 paramConfig.visibility = 'user-only'
216 }
217
218 params[key] = paramConfig
219 })
220 }
221
222 return params
223}
224
225/**
226 * Get environment variables from React Query cache (client-side only)

Callers 3

utils.test.tsFile · 0.90
fetchCustomToolFromDBFunction · 0.90
createToolConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected