api_put
Execute HTTP PUT requests to update resources at a specified URL using MCP API Server. Send data as strings or JSON objects and include custom headers for enhanced API interactions.
Instructions
Make an HTTP PUT request to the specified URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | The request body (string or JSON object) | |
| headers | No | Optional headers to include in the request | |
| url | Yes | The URL to make the PUT request to |
Implementation Reference
- src/mcp-server.ts:210-215 (handler)The main handler for the 'api_put' tool call. Dispatches the validated parameters to the APIClient's put method to execute the HTTP PUT request.case 'api_put': return await this.apiClient.put( validatedRequest.url, validatedRequest.body, validatedRequest.headers );
- src/tools.ts:69-97 (schema)Defines the MCPTool schema for 'api_put', including name, description, and inputSchema for validation.export const API_PUT_TOOL: MCPTool = { name: 'api_put', description: 'Make an HTTP PUT request to the specified URL', inputSchema: { type: 'object', properties: { url: { type: 'string', format: 'uri', description: 'The URL to make the PUT request to', }, body: { oneOf: [ { type: 'string' }, { type: 'object' }, ], description: 'The request body (string or JSON object)', }, headers: { type: 'object', description: 'Optional headers to include in the request', additionalProperties: { type: 'string', }, }, }, required: ['url'], }, };
- src/tools.ts:138-143 (registration)Registers the 'api_put' tool in the TOOL_MAP for quick lookup during tool validation and dispatch.export const TOOL_MAP: Record<string, MCPTool> = { [API_GET_TOOL.name]: API_GET_TOOL, [API_POST_TOOL.name]: API_POST_TOOL, [API_PUT_TOOL.name]: API_PUT_TOOL, [API_DELETE_TOOL.name]: API_DELETE_TOOL, };
- src/tools.ts:128-133 (registration)Includes 'api_put' tool in ALL_API_TOOLS array, used by list_tools handler to advertise available tools.export const ALL_API_TOOLS: MCPTool[] = [ API_GET_TOOL, API_POST_TOOL, API_PUT_TOOL, API_DELETE_TOOL, ];
- src/api-client.ts:91-102 (helper)The APIClient.put method that executes the actual HTTP PUT request using axios, handling body serialization and errors.async put( url: string, body?: string | object, headers?: Record<string, string> ): Promise<APIResponse | ErrorResponse> { return this.makeRequest({ url, method: 'PUT', body, headers, }); }