( paths: Record<string, Record<string, OperationInfo>> )
| 184 | * JSON Schema out of the request path. |
| 185 | */ |
| 186 | export function buildNonCodemodeTools( |
| 187 | paths: Record<string, Record<string, OperationInfo>> |
| 188 | ): NonCodemodeTool[] { |
| 189 | return listNonCodemodeOperations(paths).map( |
| 190 | ({ toolName, description, method, path, operation }) => ({ |
| 191 | name: toolName, |
| 192 | title: toolNameToTitle(toolName), |
| 193 | description, |
| 194 | inputSchema: buildJsonInputSchema(operation, path), |
| 195 | method, |
| 196 | path, |
| 197 | queryParams: (operation.parameters ?? []) |
| 198 | .filter((parameter) => parameter.in === 'query') |
| 199 | .map((parameter) => parameter.name), |
| 200 | headerParams: (operation.parameters ?? []) |
| 201 | .filter((parameter) => parameter.in === 'header') |
| 202 | .map((parameter) => ({ |
| 203 | name: parameter.name, |
| 204 | key: `header_${parameter.name.toLowerCase().replace(/-/g, '_')}` |
| 205 | })) |
| 206 | }) |
| 207 | ) |
| 208 | } |
| 209 | |
| 210 | /** Rehydrate the small Zod shape required by the SDK's tools/call validation. */ |
| 211 | export function zodInputSchemaFromJson( |
no test coverage detected