* Build execute_sql tool metadata for API response
(sourceId: string, toolConfig?: ToolConfig)
| 215 | * Build execute_sql tool metadata for API response |
| 216 | */ |
| 217 | function buildExecuteSqlTool(sourceId: string, toolConfig?: ToolConfig): Tool { |
| 218 | const executeSqlMetadata = getExecuteSqlMetadata(sourceId); |
| 219 | const executeSqlParameters = zodToParameters(executeSqlMetadata.schema); |
| 220 | |
| 221 | // Extract readonly and max_rows from toolConfig |
| 222 | // ToolConfig is a union type, but ExecuteSqlToolConfig and CustomToolConfig both have these fields |
| 223 | const readonly = toolConfig && 'readonly' in toolConfig ? toolConfig.readonly : undefined; |
| 224 | const max_rows = toolConfig && 'max_rows' in toolConfig ? toolConfig.max_rows : undefined; |
| 225 | |
| 226 | return { |
| 227 | name: executeSqlMetadata.name, |
| 228 | description: executeSqlMetadata.description, |
| 229 | parameters: executeSqlParameters, |
| 230 | readonly, |
| 231 | max_rows, |
| 232 | }; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Build search_objects tool metadata for API response |
no test coverage detected