analyze_edss_api_endpoints
Extract and analyze REST API endpoints from Open-E JovianDSS documentation. Choose version and request detailed analysis of parameters and schemas.
Instructions
Extract and analyze API endpoints from EDSS documentation
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| version | No | Documentation version to analyze | latest |
| detailed | No | Include detailed analysis of endpoints, parameters, and schemas |
Implementation Reference
- index.js:595-625 (handler)Main handler function for the analyze_edss_api_endpoints tool. Fetches documentation HTML from the specified version URL, calls extractEndpoints() to parse endpoints, and returns JSON results.
async analyzeEndpoints(args) { const { version = "latest", detailed = false } = args; try { const url = version === "latest" ? this.legacyDocUrls.latest : this.legacyDocUrls.trunk; const response = await fetch(url); if (!response.ok) { throw new Error(`Failed to fetch documentation: ${response.status}`); } const content = await response.text(); const endpoints = this.extractEndpoints(content, detailed); return { content: [ { type: "text", text: JSON.stringify({ version: version, endpoints: endpoints, total: endpoints.length, detailed: detailed }, null, 2) } ] }; } catch (error) { throw new Error(`Analysis failed: ${error.message}`); } } - index.js:100-119 (schema)Input schema definition for analyze_edss_api_endpoints. Defines two parameters: 'version' (enum: latest/trunk, default latest) and 'detailed' (boolean, default false).
{ name: "analyze_edss_api_endpoints", description: "Extract and analyze API endpoints from EDSS documentation", inputSchema: { type: "object", properties: { version: { type: "string", enum: ["latest", "trunk"], default: "latest", description: "Documentation version to analyze" }, detailed: { type: "boolean", default: false, description: "Include detailed analysis of endpoints, parameters, and schemas" } } } }, - index.js:192-193 (registration)Registration of the analyze_edss_api_endpoints tool in the CallToolRequestSchema switch statement, dispatching to this.analyzeEndpoints(args).
case "analyze_edss_api_endpoints": return await this.analyzeEndpoints(args); - index.js:686-707 (helper)extractEndpoints() helper: Parses HTML content for HTTP method + path patterns (GET/POST/PUT/DELETE/PATCH). When detailed=true, also extracts endpoint descriptions and parameters.
extractEndpoints(content, detailed) { const endpoints = []; const endpointRegex = /(GET|POST|PUT|DELETE|PATCH)\s+([\/\w\-\{\}\.]+)/g; let match; while ((match = endpointRegex.exec(content)) !== null) { const endpoint = { method: match[1], path: match[2] }; if (detailed) { // Extract additional details if requested endpoint.description = this.extractEndpointDescription(content, match.index); endpoint.parameters = this.extractParameters(content, match.index); } endpoints.push(endpoint); } return endpoints; } - index.js:709-713 (helper)extractEndpointDescription() helper: Extracts description text from a <p> tag within 200 characters before the endpoint match.
extractEndpointDescription(content, index) { const beforeContext = content.substring(Math.max(0, index - 200), index); const descMatch = beforeContext.match(/<p[^>]*>(.*?)<\/p>/s); return descMatch ? descMatch[1].replace(/<[^>]+>/g, '').trim() : ''; } - index.js:715-729 (helper)extractParameters() helper: Extracts parameter name/type pairs from JSON-like patterns within 500 characters after the endpoint match.
extractParameters(content, index) { const afterContext = content.substring(index, Math.min(content.length, index + 500)); const paramRegex = /"([^"]+)"\s*:\s*"([^"]+)"/g; const parameters = []; let paramMatch; while ((paramMatch = paramRegex.exec(afterContext)) !== null) { parameters.push({ name: paramMatch[1], type: paramMatch[2] }); } return parameters; }