(customTool: any)
| 192 | * Creates parameter schema from custom tool schema |
| 193 | */ |
| 194 | export 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) |
no outgoing calls
no test coverage detected