Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlYesURL to perform PUT operation
valueYesData to PATCH in the body

Implementation Reference

  • 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, }; }
  • 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"], }, },
  • 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, }));
  • 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"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lars-hagen/mcp-playwright-cdp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server