extract_api_schema
Extract API schema from discovered endpoints to document and analyze web service interfaces for development workflows.
Instructions
Extract API schema from discovered endpoints
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to analyze | |
| endpoint | No | Specific endpoint to extract schema from |
Implementation Reference
- src/tools/api-discovery.ts:44-61 (registration)Registration of the 'extract_api_schema' tool in the apiDiscoveryTools array, including name, description, and input schema definition.{ name: 'extract_api_schema', description: 'Extract API schema from discovered endpoints', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to analyze', }, endpoint: { type: 'string', description: 'Specific endpoint to extract schema from', }, }, required: ['url'], }, },
- src/tools/api-discovery.ts:47-60 (schema)Input schema definition for the 'extract_api_schema' tool.inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to analyze', }, endpoint: { type: 'string', description: 'Specific endpoint to extract schema from', }, }, required: ['url'], },
- src/tools/api-discovery.ts:188-193 (handler)Handler logic in handleAPIDiscoveryTool function that processes the tool call by extracting URL/endpoint params and delegating to APIScraper.extractAPISchema.case 'extract_api_schema': { const url = params.url as string; const endpoint = params.endpoint as string | undefined; const schema = await apiScraper.extractAPISchema(url, endpoint); return schema; }
- src/scrapers/api-scraper.ts:180-194 (helper)Core implementation of API schema extraction in APIScraper class, which discovers endpoints and constructs a schema object.async extractAPISchema(url: string, _endpoint?: string): Promise<Record<string, unknown>> { // This is a simplified version. In production, would analyze actual API responses const result = await this.discoverAPIEndpoints(url); const schema: Record<string, unknown> = { baseUrl: result.baseUrl, endpoints: result.endpoints.map((e) => ({ method: e.method, path: e.path, parameters: e.parameters, })), }; return schema; }