Skip to main content
Glama

api_delete

Send a DELETE request to a specified API endpoint, allowing removal of resources or data. Requires URL and optional headers for structured API interactions within browser automation workflows.

Instructions

Perform a DELETE request to an API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
headersNoRequest headers
urlYesAPI endpoint URL

Implementation Reference

  • The core handler function that performs the DELETE HTTP request to the specified URL using Playwright's APIRequestContext, returning the response status or error message.
    async function handleApiDelete(client: APIRequestContext, args: any): Promise<{ toolResult: CallToolResult }> {
      try {
        const options = args.headers ? { headers: args.headers } : undefined;
        const response = await client.delete(args.url, options);
        return {
          toolResult: {
            content: [
              {
                type: "text",
                text: `DELETE ${args.url} - Status: ${response.status()}`,
              }
            ],
            isError: false,
          },
        };
      } catch (error) {
        return {
          toolResult: {
            content: [{
              type: "text",
              text: `DELETE request failed: ${(error as Error).message}`,
            }],
            isError: true,
          },
        };
      }
    }
  • src/tools.ts:198-213 (registration)
    Registers the 'api_delete' tool in the registerTools() function, including its name, description, and input schema definition.
    {
      name: "api_delete",
      description: "Perform a DELETE request to an API endpoint",
      inputSchema: {
        type: "object",
        properties: {
          url: { type: "string", description: "API endpoint URL" },
          headers: { 
            type: "object", 
            description: "Request headers",
            additionalProperties: { type: "string" }
          }
        },
        required: ["url"]
      }
    }
  • Defines the input schema for the api_delete tool, specifying the required 'url' parameter and optional 'headers'.
    inputSchema: {
      type: "object",
      properties: {
        url: { type: "string", description: "API endpoint URL" },
        headers: { 
          type: "object", 
          description: "Request headers",
          additionalProperties: { type: "string" }
        }
      },
      required: ["url"]
    }
  • Switch case in executeToolCall that routes api_delete tool calls to the handleApiDelete handler.
    case "api_delete":
      return await handleApiDelete(apiClient!, args);
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