Skip to main content
Glama

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
NameRequiredDescriptionDefault
dataYesRequest body data (JSON string)
headersNoRequest headers
urlYesAPI endpoint URL

Implementation Reference

  • 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"]
      }
    },
  • 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"]
    }
  • 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"
    ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions performing a PATCH request, implying a partial update operation, but fails to detail critical aspects like authentication needs, error handling, rate limits, or what the response entails. This leaves significant gaps in understanding the tool's behavior.

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, clear sentence that efficiently conveys the core action without unnecessary words. It is front-loaded and appropriately sized, making it easy to understand quickly.

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 API tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, error handling, and response format, which are crucial for effective use. The description does not compensate for the absence of structured data, leaving the tool under-specified.

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 schema description coverage is 100%, so the schema already documents all parameters (url, data, headers) adequately. The description adds no additional meaning beyond what the schema provides, such as examples or usage notes, but meets the baseline since the schema handles parameter documentation.

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 states the action ('Perform a PATCH request') and target ('to an API endpoint'), which clarifies the tool's purpose. However, it does not differentiate from sibling tools like api_post or api_put beyond the HTTP method, leaving the distinction vague. It avoids tautology by specifying the request type and target.

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 such as api_post or api_put, nor does it mention any prerequisites or exclusions. It merely states what the tool does without context for selection among siblings or other tools.

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

Related 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/imprvhub/mcp-browser-agent'

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