Skip to main content
Glama

playwright_put

Execute HTTP PUT requests to send data to specified URLs, enabling direct updates or modifications to web resources in a real browser environment.

Instructions

Perform an HTTP PUT request

Input Schema

NameRequiredDescriptionDefault
urlYesURL to perform PUT operation
valueYesData to PUT in the body

Input Schema (JSON Schema)

{ "properties": { "url": { "description": "URL to perform PUT operation", "type": "string" }, "value": { "description": "Data to PUT in the body", "type": "string" } }, "required": [ "url", "value" ], "type": "object" }

Implementation Reference

  • The PutRequestTool class and its execute method implement the core logic for the 'playwright_put' tool, performing an HTTP PUT request using Playwright's APIRequestContext.put(), handling JSON validation, and returning status and response details.
    export class PutRequestTool extends ApiToolBase { /** * Execute the PUT 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.put(args.url, { data: args.value }); let responseText; try { responseText = await response.text(); } catch (error) { responseText = "Unable to get response text"; } return createSuccessResponse([ `PUT request to ${args.url}`, `Status: ${response.status()} ${response.statusText()}`, `Response: ${responseText.substring(0, 1000)}${responseText.length > 1000 ? '...' : ''}` ]); }); } }
  • Tool schema definition for 'playwright_put', including name, description, and input schema requiring 'url' and 'value' parameters.
    { name: "playwright_put", description: "Perform an HTTP PUT request", inputSchema: { type: "object", properties: { url: { type: "string", description: "URL to perform PUT operation" }, value: { type: "string", description: "Data to PUT in the body" }, }, required: ["url", "value"], }, },
  • Registration and dispatch in the main tool handler switch statement, routing 'playwright_put' calls to the PutRequestTool.execute method.
    case "playwright_put": return await putRequestTool.execute(args, context);
  • Instantiation of the PutRequestTool instance in the initializeTools function.
    if (!putRequestTool) putRequestTool = new PutRequestTool(server);
  • src/tools.ts:431-432 (registration)
    Inclusion of 'playwright_put' in the API_TOOLS array for conditional API context initialization.
    "playwright_put", "playwright_delete",

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/pvinis/mcp-playwright-stealth'

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