Skip to main content
Glama
devskido

Playwright MCP Server

by devskido

playwright_patch

Update specific parts of web content by sending HTTP PATCH requests through browser automation, enabling targeted modifications to web resources.

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 execute method of PatchRequestTool performs the PATCH HTTP request. It validates JSON input if applicable, sends the request via Playwright's APIRequestContext.patch, retrieves the response text, and formats a success response with status and truncated body.
    async execute(args: any, context: ToolContext): Promise<ToolResponse> {
      return this.safeExecute(context, async (apiContext) => {
        // Check if the value is valid JSON if it starts with { or [
        if (args.value && typeof args.value === 'string' && 
            (args.value.startsWith('{') || args.value.startsWith('['))) {
          try {
            JSON.parse(args.value);
          } catch (error) {
            return createErrorResponse(`Failed to parse request body: ${(error as Error).message}`);
          }
        }
        
        const response = await apiContext.patch(args.url, {
          data: args.value
        });
        
        let responseText;
        try {
          responseText = await response.text();
        } catch (error) {
          responseText = "Unable to get response text";
        }
        
        return createSuccessResponse([
          `PATCH request to ${args.url}`,
          `Status: ${response.status()} ${response.statusText()}`,
          `Response: ${responseText.substring(0, 1000)}${responseText.length > 1000 ? '...' : ''}`
        ]);
      });
    }
  • Tool schema definition including name, description, and input schema requiring '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"],
      },
    },
  • Dispatch/registration in handleToolCall switch statement that routes 'playwright_patch' tool calls to the PatchRequestTool handler.
    case "playwright_patch":
      return await patchRequestTool.execute(args, context);
  • Instantiation of PatchRequestTool instance during tool initialization in initializeTools function.
    if (!getRequestTool) getRequestTool = new GetRequestTool(server);
    if (!postRequestTool) postRequestTool = new PostRequestTool(server);
    if (!putRequestTool) putRequestTool = new PutRequestTool(server);
    if (!patchRequestTool) patchRequestTool = new PatchRequestTool(server);
    if (!deleteRequestTool) deleteRequestTool = new DeleteRequestTool(server);
  • The safeExecute helper method in ApiToolBase used by PatchRequestTool to ensure API context is available and handle execution errors.
    protected async safeExecute(
      context: ToolContext,
      operation: (apiContext: APIRequestContext) => Promise<ToolResponse>
    ): Promise<ToolResponse> {
      const apiError = this.validateApiContextAvailable(context);
      if (apiError) return apiError;
    
      try {
        return await operation(context.apiContext!);
      } catch (error) {
        return createErrorResponse(`API operation failed: ${(error as Error).message}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Perform an HTTP PATCH request' which implies a network operation with potential side effects, but doesn't disclose traits like error handling, authentication needs, rate limits, or what happens on success/failure. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—'Perform an HTTP PATCH request' is front-loaded and appropriately sized for its purpose. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of an HTTP PATCH tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, return values, error cases, or usage context. While the schema covers parameters, the overall tool understanding is inadequate for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with 'url' and 'value' parameters clearly documented. The description adds no additional meaning beyond what the schema provides (e.g., no details on URL format or data encoding). With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Perform an HTTP PATCH request' clearly states the action (PATCH) but is generic and doesn't specify what resource or context it operates on. It distinguishes from siblings like playwright_post or playwright_put by mentioning PATCH, but lacks specificity about the target (e.g., web pages, APIs). This is vague but not tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like playwright_put or playwright_post, nor does it mention prerequisites or context. It implies usage for HTTP PATCH requests but offers no explicit when/when-not rules or sibling comparisons, leaving the agent to infer based on general HTTP knowledge.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/devskido/customed-playwright'

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