playwright_patch
Send HTTP PATCH requests to update specific parts of web resources through browser automation, enabling partial modifications to existing data on servers.
Instructions
Perform an HTTP PATCH request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to perform PUT operation | |
| value | Yes | Data to PATCH in the body |
Implementation Reference
- src/toolsHandler.ts:438-469 (handler)The main handler logic for the 'playwright_patch' tool, which performs an HTTP PATCH request to the specified URL with the provided JSON data using Playwright's APIRequestContext and returns the response details.case "playwright_patch": try { var data = { data: args.value, headers: { 'Content-Type': 'application/json' } }; var response = await apiContext!.patch(args.url, data); return { content: [{ type: "text", text: `Performed PATCH Operation ${args.url} with data ${JSON.stringify(args.value, null, 2)}`, }, { type: "text", text: `Response: ${JSON.stringify(await response.json(), null, 2)}`, }, { type: "text", text: `Response code ${response.status()}` }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to perform PATCH operation on ${args.url}: ${(error as Error).message}`, }], isError: true, }; }
- src/tools.ts:129-140 (schema)The input schema definition for the 'playwright_patch' tool, specifying required 'url' and 'value' parameters.{ name: "playwright_patch", description: "Perform an HTTP PATCH request", inputSchema: { type: "object", properties: { url: { type: "string", description: "URL to perform PUT operation" }, value: { type: "string", description: "Data to PATCH in the body" }, }, required: ["url", "value"], }, },
- src/requestHandler.ts:59-62 (registration)Registration of the tool list handler, which exposes the 'playwright_patch' tool (included in the 'tools' array from createToolDefinitions) to the MCP client.// List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
- src/tools.ts:166-172 (helper)Helper array identifying 'playwright_patch' as an API tool, used to conditionally set up APIRequestContext without launching a browser.// API Request tools for conditional launch export const API_TOOLS = [ "playwright_get", "playwright_post", "playwright_put", "playwright_delete", "playwright_patch"