search_endpoints
Locate specific DigitalOcean API endpoints by entering a search query and optionally setting a result limit. Enhances access to over 471 endpoints via the MCP server, enabling precise filtering and direct API calls with authentication.
Instructions
Search for DigitalOcean API endpoints
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Limit number of results | |
| query | Yes | Search query |
Implementation Reference
- src/index.ts:240-257 (handler)Primary execution handler for the search_endpoints tool. It destructures the query and optional limit from args, searches using the helper, limits results, formats as bullet list, and returns formatted text content.
private async handleSearchEndpoints(args: any) { const { query, limit = 20 } = args; const endpoints = searchEndpoints(query).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 matching "${query}":\n\n${endpointList}`, }, ], }; } - src/index.ts:95-113 (registration)Tool registration in the MCP server's listTools response, defining name, description, and inputSchema for search_endpoints.
{ name: 'search_endpoints', description: 'Search for DigitalOcean API endpoints', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query', }, limit: { type: 'number', description: 'Limit number of results', default: 20, }, }, required: ['query'], }, } as Tool, - src/endpoints.ts:32-42 (helper)Core helper function implementing the search logic by filtering endpoints based on case-insensitive matches in operationId, summary, description, or tags.
export function searchEndpoints(query: string): DOEndpoint[] { const endpoints = loadEndpoints(); const lowercaseQuery = query.toLowerCase(); return endpoints.filter(ep => ep.operationId.toLowerCase().includes(lowercaseQuery) || ep.summary.toLowerCase().includes(lowercaseQuery) || ep.description.toLowerCase().includes(lowercaseQuery) || ep.tags.some(tag => tag.toLowerCase().includes(lowercaseQuery)) ); }