get_endpoint_details
Retrieve detailed configuration and folder information for specific API endpoints to support development workflows and endpoint management.
Instructions
Get detailed endpoint configuration with folder information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint_id | Yes | Endpoint ID to get details for (required) |
Implementation Reference
- The handler function that executes the 'get_endpoint_details' tool logic: validates input, fetches details from backend API with timeout and auth, formats output, handles errors.export async function handleGetEndpointDetails(args: Record<string, any>): Promise<McpToolResponse> { try { const { configManager, backendClient } = await getEndpointDependencies(); const endpointId = args.endpoint_id as string; if (!endpointId) { throw new Error('Endpoint ID is required'); } // Get endpoint details const apiEndpoints = getApiEndpoints(); const endpoint = apiEndpoints.getEndpoint('endpointDetails', { id: endpointId }); const fullUrl = `${backendClient.getBaseUrl()}${endpoint}`; console.error(`[EndpointTools] Requesting endpoint details from: ${fullUrl}`); // Create AbortController for timeout const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 second timeout try { const result = await fetch(fullUrl, { method: 'GET', headers: { 'Authorization': `Bearer ${backendClient.getToken()}`, 'Content-Type': 'application/json' }, signal: controller.signal }); clearTimeout(timeoutId); // Clear timeout if request succeeds if (!result.ok) { throw new Error(`HTTP ${result.status}: ${result.statusText}`); } const data = await result.json() as EndpointDetailsResponse; if (data.success && data.data) { const detailsText = formatEndpointDetailsText(data.data); return { content: [ { type: 'text', text: detailsText } ] }; } else { return { content: [ { type: 'text', text: `❌ Failed to get endpoint details: ${data.message || 'Unknown error'}` } ], isError: true }; } // Handle network and timeout errors specifically } catch (networkError) { clearTimeout(timeoutId); // Ensure timeout is cleared on error let errorMessage = 'Network error occurred'; if (networkError instanceof Error) { if (networkError.name === 'AbortError') { errorMessage = 'Request timeout (30 seconds)'; } else { errorMessage = `Network error: ${networkError.message}`; } } return { content: [ { type: 'text', text: `❌ ${errorMessage}` } ], isError: true }; } } catch (error) { return { content: [ { type: 'text', text: `❌ Endpoint details error: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/tools/endpoints/tools.ts:28-42 (schema)Tool schema definition: name, description, and inputSchema for validating parameters (endpoint_id).// Tool: get_endpoint_details export const getEndpointDetailsTool: McpTool = { name: 'get_endpoint_details', description: 'Get detailed endpoint configuration with folder information', inputSchema: { type: 'object', properties: { endpoint_id: { type: 'string', description: 'Endpoint ID to get details for (required)' } }, required: ['endpoint_id'] } };
- src/tools/endpoints/handlers.ts:36-44 (registration)Maps the tool name 'get_endpoint_details' to its handler function handleGetEndpointDetails in the handlers object returned by createEndpointToolHandlers.export function createEndpointToolHandlers(): Record<string, EndpointToolHandler> { return { [listEndpointsTool.name]: handleListEndpoints, [getEndpointDetailsTool.name]: handleGetEndpointDetails, [createEndpointTool.name]: handleCreateEndpoint, [updateEndpointTool.name]: handleUpdateEndpoint, [deleteEndpointTool.name]: handleDeleteEndpoint }; }