update_api
Updates an existing API by modifying its name, summary, or description using the API ID.
Instructions
Update an existing API
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiId | Yes | API ID | |
| name | No | New API name | |
| summary | No | Updated brief description | |
| description | No | Updated detailed description |
Implementation Reference
- src/tools/api/apis/index.ts:138-149 (handler)The handler function that executes the update_api tool logic. It validates apiId is present, extracts it from args, and sends a PUT request to /apis/{apiId} with the remaining data.
/** * Update an existing API * @param args Parameters including apiId (required) */ async updateApi(args: any): Promise<ToolCallResponse> { if (!args.apiId) { throw new McpError(ErrorCode.InvalidParams, 'apiId is required'); } const { apiId, ...data } = args; const response = await this.client.put(`/apis/${apiId}`, data); return this.createResponse(response.data); } - src/types/apis.ts:44-49 (schema)TypeScript interface defining the input schema for update_api: optional name, summary, description, and versionTag fields.
export interface UpdateApiRequest { name?: string; summary?: string; description?: string; versionTag?: string; } - src/tools/api/apis/index.ts:45-46 (registration)The switch-case registration mapping the string 'update_api' to the updateApi handler method.
case 'update_api': return await this.updateApi(args); - src/tools/api/apis/definitions.ts:83-108 (registration)Tool definition registration for update_api, declaring its name, description, and JSON input schema with apiId (required), name, summary, and description (optional).
{ name: 'update_api', description: 'Update an existing API', inputSchema: { type: 'object', properties: { apiId: { type: 'string', description: 'API ID', }, name: { type: 'string', description: 'New API name', }, summary: { type: 'string', description: 'Updated brief description', }, description: { type: 'string', description: 'Updated detailed description', }, }, required: ['apiId'], }, }, - src/tools/api/apis/index.ts:26-30 (helper)Helper createResponse utility used by updateApi to format the API response as JSON text content.
private createResponse(data: any): ToolCallResponse { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; }