Skip to main content
Glama
devskido

Playwright MCP Server

by devskido

playwright_post

Execute HTTP POST requests with specified URL, data, and optional headers. Ideal for sending data to web servers, APIs, or integrating with browser automation workflows using Playwright MCP Server.

Instructions

Perform an HTTP POST request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
headersNoAdditional headers to include in the request
tokenNoBearer token for authorization
urlYesURL to perform POST operation
valueYesData to post in the body

Implementation Reference

  • PostRequestTool class with execute method implementing the playwright_post tool logic using Playwright's request API to perform POST requests.
    export class PostRequestTool extends ApiToolBase { /** * Execute the POST request tool */ 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.post(args.url, { data: typeof args.value === 'string' ? JSON.parse(args.value) : args.value, headers: { 'Content-Type': 'application/json', ...(args.token ? { 'Authorization': `Bearer ${args.token}` } : {}), ...(args.headers || {}) } }); let responseText; try { responseText = await response.text(); } catch (error) { responseText = "Unable to get response text"; } return createSuccessResponse([ `POST request to ${args.url}`, `Status: ${response.status()} ${response.statusText()}`, `Response: ${responseText.substring(0, 1000)}${responseText.length > 1000 ? '...' : ''}` ]); }); } }
  • Input schema definition for the playwright_post tool, including parameters for URL, body data, optional token, and headers.
    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" }, token: { type: "string", description: "Bearer token for authorization" }, headers: { type: "object", description: "Additional headers to include in the request", additionalProperties: { type: "string" } } }, required: ["url", "value"], }, },
  • Dispatch/registration of playwright_post tool in the main handleToolCall switch statement, calling postRequestTool.execute.
    case "playwright_post": return await postRequestTool.execute(args, context);
  • Initialization and instantiation of the PostRequestTool instance.
    if (!postRequestTool) postRequestTool = new PostRequestTool(server);
  • src/tools.ts:478-482 (registration)
    Inclusion of playwright_post in the API_TOOLS array used for tool categorization and conditional API context setup.
    "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/devskido/customed-playwright'

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