get_endpoint_schema
Retrieve detailed OpenAPI schema for specific API endpoints, including request parameters, response fields, and related endpoints, to streamline API integration.
Instructions
🎯 GET PRECISE ENDPOINT SCHEMA - Returns exact OpenAPI schema for specific endpoints.
Perfect for when you need:
• Exact request parameter names and types
• Response field names and structures
• Required vs optional parameters
• Related endpoints for the same use case
Example queries this replaces:
• "bills endpoint response schema fields amount vendor status" → Use this tool with /developer/v1/bills
• "API pagination limit page_size next cursor" → Get schema for any paginated endpoint
• "cards creation request parameters" → Use this tool with /developer/v1/cards
Usage: Provide an endpoint path (and optionally method) to get the complete technical specification.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes | The endpoint path (e.g., '/developer/v1/bills', '/developer/v1/limits') | |
| include_related | No | Include related endpoints for the same use case | |
| method | No | HTTP method (GET, POST, PUT, etc.). If not specified, will show most relevant method. |
Implementation Reference
- src/tools/get_endpoint_schema.py:83-118 (handler)Core handler function that processes input arguments, locates matching OpenAPI endpoints, generates formatted schema output, and handles errors gracefully.async def execute(self, arguments: Dict[str, Any]) -> List[TextContent]: """Execute schema retrieval""" endpoint = arguments.get("endpoint", "").strip() method = arguments.get("method", "").upper() if arguments.get("method") else None include_related = arguments.get("include_related", True) if not endpoint: return [TextContent( type="text", text="❌ Please provide an endpoint path (e.g., '/developer/v1/bills')" )] try: # Find matching endpoint(s) matching_endpoints = self._find_matching_endpoints(endpoint, method) if not matching_endpoints: similar = self._find_similar_endpoints(endpoint) suggestion_text = f"\n\n**Similar endpoints available:**\n" + "\n".join([f"• {ep}" for ep in similar[:5]]) if similar else "" return [TextContent( type="text", text=f"❌ Endpoint not found: `{method + ' ' if method else ''}{endpoint}`{suggestion_text}" )] # Format the schema response result_text = self._format_endpoint_schemas(matching_endpoints, include_related) return [TextContent(type="text", text=result_text)] except Exception as e: return [TextContent( type="text", text=f"❌ Error retrieving schema: {str(e)}" )]
- Input schema definition specifying required 'endpoint' parameter and optional 'method' and 'include_related' fields.def input_schema(self) -> Dict[str, Any]: return { "type": "object", "properties": { "endpoint": { "type": "string", "description": "The endpoint path (e.g., '/developer/v1/bills', '/developer/v1/limits')" }, "method": { "type": "string", "description": "HTTP method (GET, POST, PUT, etc.). If not specified, will show most relevant method.", "enum": ["GET", "POST", "PUT", "PATCH", "DELETE"] }, "include_related": { "type": "boolean", "default": True, "description": "Include related endpoints for the same use case" } }, "required": ["endpoint"] }
- src/tools/get_endpoint_schema.py:40-41 (registration)Property defining the exact tool name 'get_endpoint_schema' used for MCP tool registration.def name(self) -> str: return "get_endpoint_schema"
- src/server.py:46-51 (registration)Server registration where GetEndpointSchemaTool is instantiated with knowledge_base and added to the list of available MCP tools.tools = [ PingTool(), SearchDocumentationTool(knowledge_base), SubmitFeedbackTool(), GetEndpointSchemaTool(knowledge_base) ]
- Helper method that pre-extracts all endpoints from the OpenAPI spec for efficient lookup during execution.def _extract_all_endpoints(self) -> Dict[str, Dict[str, Any]]: """Extract all endpoints with their details""" endpoints = {} paths = self.spec.get('paths', {}) for path, methods in paths.items(): for method, details in methods.items(): if method.upper() in ['GET', 'POST', 'PUT', 'DELETE', 'PATCH']: key = f"{method.upper()} {path}" endpoints[key] = { 'path': path, 'method': method.upper(), 'details': details, 'parameters': details.get('parameters', []), 'responses': details.get('responses', {}), 'requestBody': details.get('requestBody', {}) } return endpoints