Get Cookies
pinchtab_cookiesRetrieve all cookies set by the currently active webpage to inspect or debug session data.
Instructions
Get all cookies for the current page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/instances.ts:46-60 (registration)Registration of 'pinchtab_cookies' tool via server.registerTool. It calls pinch('GET', '/cookies') to retrieve all cookies for the current page.
server.registerTool( "pinchtab_cookies", { description: "Get all cookies for the current page.", inputSchema: z.object({}), title: "Get Cookies", }, async () => { try { return toolResult(await pinch("GET", "/cookies")); } catch (error) { return toolError(error); } }, ); - src/pinchtab/client.ts:6-49 (helper)The pinch() helper function that makes HTTP requests to the PinchTab server. Used by the cookies tool to GET /cookies.
export async function pinch( method: string, path: string, body?: Record<string, unknown>, ): Promise<unknown> { if (!(await isPinchtabRunning())) { await ensurePinchtabRunning(); } const headers: Record<string, string> = { "Content-Type": "application/json", }; if (PINCHTAB_TOKEN) { headers["Authorization"] = `Bearer ${PINCHTAB_TOKEN}`; } const url = `${PINCHTAB_URL}${path}`; let res: Response; try { res = await fetch(url, { body: body ? JSON.stringify(body) : undefined, headers, method, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), }); } catch (error) { if (error instanceof DOMException && error.name === "TimeoutError") { throw new Error(`PinchTab ${method} ${path} timed out after ${REQUEST_TIMEOUT_MS / 1000}s`); } throw error; } if (!res.ok) { const text = await res.text(); throw new Error(`PinchTab ${method} ${path} → ${res.status}: ${text}`); } const contentType = (res.headers.get("content-type") ?? "").split(";")[0].toLowerCase().trim(); if (contentType === "application/json") { return res.json(); } return res.text(); } - src/utils.ts:18-29 (helper)The toolResult() and toolError() helper functions used by the cookies handler to format success/error responses.
export function toolResult(data: unknown): ToolResult { return { content: [{ text: toJson(data), type: "text" as const }] }; } /** Format an error as an MCP tool error response. */ export function toolError(error: unknown): ToolResult { const message = error instanceof Error ? error.message : String(error); return { content: [{ text: message, type: "text" as const }], isError: true, }; } - src/tools/instances.ts:49-51 (schema)Input schema for pinchtab_cookies: an empty object (z.object({})), meaning no parameters are required.
description: "Get all cookies for the current page.", inputSchema: z.object({}), title: "Get Cookies", - src/tools/index.ts:7-12 (registration)registerAllTools() calls registerInstanceTools(), which registers pinchtab_cookies among other tools.
export function registerAllTools(server: McpServer) { registerInstanceTools(server); registerNavigationTools(server); registerInteractionTools(server); registerContentTools(server); }