list_endpoints
Explore and filter DigitalOcean API endpoints using tag or limit criteria. Dynamically extract and manage endpoints from OpenAPI specifications for efficient API access.
Instructions
List all available DigitalOcean API endpoints
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Limit number of results | |
| tag | No | Filter by tag (optional) |
Implementation Reference
- src/index.ts:220-238 (handler)The handler function that implements the core logic for the 'list_endpoints' tool. It destructures arguments for tag filter and limit, loads or filters endpoints accordingly, slices to the limit, formats them into a bullet list, and returns a text content response.private async handleListEndpoints(args: any) { const { tag, limit = 50 } = args; let endpoints = tag ? getEndpointsByTag(tag) : loadEndpoints(); endpoints = endpoints.slice(0, limit); const endpointList = endpoints.map(ep => `• ${ep.method} ${ep.path} - ${ep.summary} (${ep.operationId})` ).join('\n'); return { content: [ { type: 'text', text: `Found ${endpoints.length} endpoints:\n\n${endpointList}`, }, ], }; }
- src/index.ts:79-93 (schema)The input schema definition for the 'list_endpoints' tool, specifying optional 'tag' string and 'limit' number parameters.inputSchema: { type: 'object', properties: { tag: { type: 'string', description: 'Filter by tag (optional)', }, limit: { type: 'number', description: 'Limit number of results', default: 50, }, }, required: [], },
- src/index.ts:168-170 (registration)The switch case registration in the CallToolRequest handler that routes 'list_endpoints' calls to the handleListEndpoints method.case 'list_endpoints': return await this.handleListEndpoints(args);
- src/index.ts:76-94 (registration)The tool object registration in the ListToolsRequest handler, including name, description, and schema.{ name: 'list_endpoints', description: 'List all available DigitalOcean API endpoints', inputSchema: { type: 'object', properties: { tag: { type: 'string', description: 'Filter by tag (optional)', }, limit: { type: 'number', description: 'Limit number of results', default: 50, }, }, required: [], }, } as Tool,
- src/endpoints.ts:11-25 (helper)Helper function loadEndpoints() that loads and caches DigitalOcean API endpoints from JSON file, used when no tag filter is provided.export function loadEndpoints(): DOEndpoint[] { if (cachedEndpoints) { return cachedEndpoints; } try { const endpointsPath = join(__dirname, '..', 'digitalocean_endpoints.json'); const data = readFileSync(endpointsPath, 'utf-8'); cachedEndpoints = JSON.parse(data) as DOEndpoint[]; return cachedEndpoints; } catch (error) { console.error('Failed to load endpoints:', error); return []; } }