Health Check
pinchtab_healthDetermines if the PinchTab server is operational and responsive for browser automation.
Instructions
Check if PinchTab server is running and responsive.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "pinchtab_health"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/instances.ts:62-76 (registration)Registration of 'pinchtab_health' tool with server.registerTool(), including description and inputSchema.
server.registerTool( "pinchtab_health", { description: "Check if PinchTab server is running and responsive.", inputSchema: z.object({}), title: "Health Check", }, async () => { try { return toolResult(await pinch("GET", "/health")); } catch (error) { return toolError(error); } }, ); - src/tools/instances.ts:69-75 (handler)Handler function that executes the health check by calling pinch('GET', '/health') and returning the result or error.
async () => { try { return toolResult(await pinch("GET", "/health")); } catch (error) { return toolError(error); } }, - src/tools/instances.ts:64-67 (schema)Input schema for pinchtab_health: empty object (no parameters needed). Title is 'Health Check'.
{ description: "Check if PinchTab server is running and responsive.", inputSchema: z.object({}), title: "Health Check", - src/pinchtab/client.ts:6-49 (helper)The pinch() helper function used by the handler to make HTTP requests to the PinchTab server (GET /health).
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-28 (helper)Utility functions toolResult() and toolError() used by the 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, };