playwright_put
Send HTTP PUT requests to update web resources by providing URL and data payload for browser automation tasks.
Instructions
Perform an HTTP PUT request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to perform PUT operation | |
| value | Yes | Data to PUT in the body |
Implementation Reference
- src/tools/api/requests.ts:78-112 (handler)PutRequestTool.execute method implements the core logic: performs HTTP PUT request via apiContext.put, handles JSON validation, extracts and truncates response.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 ? '...' : ''}` ]); }); } }
- src/tools.ts:272-283 (schema)Input schema definition for the playwright_put tool in createToolDefinitions().{ 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"], }, },
- src/toolHandler.ts:530-531 (registration)Dispatch in handleToolCall switch statement routes 'playwright_put' calls to the PutRequestTool instance.case "playwright_put": return await putRequestTool.execute(args, context);
- src/toolHandler.ts:338-338 (registration)Instantiation of PutRequestTool instance in initializeTools().if (!putRequestTool) putRequestTool = new PutRequestTool(server);
- src/tools.ts:475-481 (helper)playwright_put listed in API_TOOLS, used in toolHandler to conditionally create API request context.// API Request tools for conditional launch export const API_TOOLS = [ "playwright_get", "playwright_post", "playwright_put", "playwright_delete", "playwright_patch"