api_patch
Execute a PATCH request to update data at an API endpoint. Specify the URL, JSON payload, and headers to modify resources efficiently via the Browser Agent MCP server.
Instructions
Perform a PATCH 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:613-646 (handler)The core handler function that performs the PATCH HTTP request using Playwright's APIRequestContext, processes the response, and returns the tool result.async function handleApiPatch(client: APIRequestContext, args: any): Promise<{ toolResult: CallToolResult }> { try { const options = { data: args.data, headers: args.headers || { 'Content-Type': 'application/json' } }; const response = await client.patch(args.url, options); const responseData = await getResponseData(response); return { toolResult: { content: [ { type: "text", text: `PATCH ${args.url} - Status: ${response.status()}`, }, ...responseData ], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `PATCH request failed: ${(error as Error).message}`, }], isError: true, }, }; } }
- src/tools.ts:182-197 (registration)The tool registration object defining the name, description, and input schema for 'api_patch', returned by registerTools().name: "api_patch", description: "Perform a PATCH 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/tools.ts:184-196 (schema)Input schema defining the parameters for the 'api_patch' tool: url (required), data (required), and optional headers.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:218-219 (registration)Switch case in executeToolCall that routes 'api_patch' calls to the handleApiPatch function.case "api_patch": return await handleApiPatch(apiClient!, args);
- src/tools.ts:14-20 (registration)Array listing 'api_patch' among API tools, used to determine if API client initialization is needed.export const API_TOOLS = [ "api_get", "api_post", "api_put", "api_patch", "api_delete" ];