Skip to main content
Glama

update_endpoint

Modify existing API endpoint configurations including HTTP methods, URLs, headers, request parameters, and response schemas to maintain accurate API documentation and testing workflows.

Instructions

Update existing endpoint configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpoint_idYesEndpoint ID to update (required)
nameNoUpdated endpoint name (optional)
methodNoUpdated HTTP method (optional)
urlNoUpdated endpoint URL (optional)
descriptionNoUpdated endpoint description (optional)
headersNoUpdated request headers as key-value pairs
bodyNoUpdated request body (JSON string)
purposeNoUpdated business purpose (optional)
request_paramsNoUpdated parameter documentation: {param_name: "description"}
response_schemaNoUpdated response field documentation: {field_name: "description"}
header_docsNoUpdated header documentation: {header_name: "description"}

Implementation Reference

  • Primary handler function that executes the update_endpoint tool: validates input, formats data, calls backendClient.updateEndpoint, handles response and errors.
    export async function handleUpdateEndpoint(args: Record<string, any>): Promise<McpToolResponse> { try { console.error('[UPDATE-HANDLER] Starting update endpoint with args:', args); console.error('[UPDATE-HANDLER] About to get dependencies...'); const { configManager, backendClient } = await getEndpointDependencies(); console.error('[UPDATE-HANDLER] Dependencies loaded successfully'); const endpointId = args.endpoint_id as string; const name = args.name as string | undefined; const method = args.method as HttpMethod | undefined; const url = args.url as string | undefined; const description = args.description as string | undefined; const headers = args.headers as Record<string, string> | undefined; const body = args.body as string | undefined; // Build update data const updateData: any = {}; if (name !== undefined) updateData.name = name.trim(); if (method !== undefined) updateData.method = method; if (url !== undefined) updateData.url = url.trim(); if (description !== undefined) updateData.description = description.trim() || null; if (headers !== undefined) updateData.headers = formatHeaders(headers); if (body !== undefined) updateData.body = formatBody(body); // Validate const validationErrors = validateUpdateData({ endpoint_id: endpointId, updateData }); if (validationErrors.length > 0) { throw new Error(validationErrors.join('\n')); } // Update endpoint using BackendClient console.error(`[EndpointTools] Updating endpoint: ${endpointId}`); const result = await backendClient.updateEndpoint(endpointId, updateData); if (!result.success) { throw new Error(`Failed to update endpoint: ${result.error || 'Unknown error'}`); } if (result.data) { const updateText = formatEndpointUpdateText(result.data); return { content: [ { type: 'text', text: updateText } ] }; } else { return { content: [ { type: 'text', text: `❌ Failed to update endpoint: No data returned` } ], isError: true }; } } catch (error) { console.error('[UPDATE-HANDLER] Error caught:', error); return { content: [ { type: 'text', text: `❌ Endpoint update error: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
  • McpTool definition for 'update_endpoint' including name, description, and detailed inputSchema for parameters.
    export const updateEndpointTool: McpTool = { name: 'update_endpoint', description: 'Update existing endpoint configuration', inputSchema: { type: 'object', properties: { endpoint_id: { type: 'string', description: 'Endpoint ID to update (required)' }, name: { type: 'string', description: 'Updated endpoint name (optional)' }, method: { type: 'string', description: 'Updated HTTP method (optional)', enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'] }, url: { type: 'string', description: 'Updated endpoint URL (optional)' }, description: { type: 'string', description: 'Updated endpoint description (optional)' }, headers: { type: 'object', description: 'Updated request headers as key-value pairs', additionalProperties: { type: 'string', description: 'Header value' } }, body: { type: 'string', description: 'Updated request body (JSON string)' }, purpose: { type: 'string', description: 'Updated business purpose (optional)' }, request_params: { type: 'object', description: 'Updated parameter documentation: {param_name: "description"}', additionalProperties: { type: 'string', description: 'Parameter description' } }, response_schema: { type: 'object', description: 'Updated response field documentation: {field_name: "description"}', additionalProperties: { type: 'string', description: 'Response field description' } }, header_docs: { type: 'object', description: 'Updated header documentation: {header_name: "description"}', additionalProperties: { type: 'string', description: 'Header description' } } }, required: ['endpoint_id'] } };
  • Registers the handler for 'update_endpoint' by mapping updateEndpointTool.name to handleUpdateEndpoint in the tool handlers object.
    export function createEndpointToolHandlers(): Record<string, EndpointToolHandler> { return { [listEndpointsTool.name]: handleListEndpoints, [getEndpointDetailsTool.name]: handleGetEndpointDetails, [createEndpointTool.name]: handleCreateEndpoint, [updateEndpointTool.name]: handleUpdateEndpoint, [deleteEndpointTool.name]: handleDeleteEndpoint }; }
  • Adds updateEndpointTool to the ENDPOINT_TOOLS array, which collects all endpoint management tools for MCP registration.
    export const ENDPOINT_TOOLS: McpTool[] = [ listEndpointsTool, getEndpointDetailsTool, createEndpointTool, updateEndpointTool, deleteEndpointTool ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/martin-1103/mcp2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server