Skip to main content
Glama

playwright_post

Send HTTP POST requests to submit data to web endpoints through browser automation, enabling form submissions and API interactions via Playwright with Chrome DevTools Protocol.

Instructions

Perform an HTTP POST request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to perform POST operation
valueYesData to post in the body

Implementation Reference

  • The handler logic within handleToolCall that executes the playwright_post tool by sending a POST request using Playwright's APIRequestContext.
    case "playwright_post": try { var data = { data: args.value, headers: { 'Content-Type': 'application/json' } }; var response = await apiContext!.post(args.url, data); return { content: [{ type: "text", text: `Performed POST 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 POST operation on ${args.url}: ${(error as Error).message}`, }], isError: true, }; }
  • Tool definition object containing name, description, and inputSchema for the playwright_post tool.
    { name: "playwright_post", description: "Perform an HTTP POST request", inputSchema: { type: "object", properties: { url: { type: "string", description: "URL to perform POST operation" }, value: { type: "string", description: "Data to post in the body" }, }, required: ["url", "value"], }, },
  • API_TOOLS constant array that includes 'playwright_post', used in toolsHandler.ts to determine if API context is needed without launching a browser.
    export const API_TOOLS = [ "playwright_get", "playwright_post", "playwright_put", "playwright_delete", "playwright_patch" ];
  • src/index.ts:22-26 (registration)
    Where the tool definitions are created and passed to setupRequestHandlers for MCP server registration.
    // Create tool definitions const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);
  • Registration of the general tool call handler that dispatches to specific tool handlers including playwright_post.
    server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, server) );

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