api_put
Send data updates to an API endpoint using the PUT method. Specify the URL, JSON data, and headers to modify server-side resources efficiently.
Instructions
Perform a PUT request to an API endpoint
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Request body data (JSON string) | |
| headers | No | Request headers | |
| url | Yes | API endpoint URL |
Implementation Reference
- src/executor.ts:578-610 (handler)The handler function that implements the core logic of the 'api_put' tool by performing a PUT request using the API client.async function handleApiPut(client: APIRequestContext, args: any): Promise<{ toolResult: CallToolResult }> { try { const options = { data: args.data, headers: args.headers || { 'Content-Type': 'application/json' } }; const response = await client.put(args.url, options); const responseData = await getResponseData(response); return { toolResult: { content: [ { type: "text", text: `PUT ${args.url} - Status: ${response.status()}`, }, ...responseData ], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `PUT request failed: ${(error as Error).message}`, }], isError: true, }, }; }
- src/tools.ts:164-179 (schema)The tool schema definition including name, description, and input validation schema for 'api_put'.{ name: "api_put", description: "Perform a PUT request to an API endpoint", inputSchema: { type: "object", properties: { url: { type: "string", description: "API endpoint URL" }, data: { type: "string", description: "Request body data (JSON string)" }, headers: { type: "object", description: "Request headers", additionalProperties: { type: "string" } } }, required: ["url", "data"] }
- src/executor.ts:215-216 (registration)The dispatch/registration case in the main executeTool function that maps the 'api_put' tool name to its handler.case "api_put": return await handleApiPut(apiClient!, args);