Skip to main content
Glama
maderwin

pinchtab-mcp

Export PDF

pinchtab_pdf

Export the current web page to a PDF file, returned as base64-encoded data. Capture page content in a portable format for sharing or archiving.

Instructions

Export the current page as a PDF. Returns the PDF as base64.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for 'pinchtab_pdf' — sends a GET request to '/pdf' via the pinch client, returns the result as text content.
      async () => {
        try {
          const result = await pinch("GET", "/pdf");
          const text = typeof result === "string" ? result : toJson(result);
          return { content: [{ text, type: "text" as const }] };
        } catch (error) {
          return toolError(error);
        }
      },
    );
  • Registration of the 'pinchtab_pdf' tool via server.registerTool with description and empty input schema.
    server.registerTool(
      "pinchtab_pdf",
      {
        description: "Export the current page as a PDF. Returns the PDF as base64.",
        inputSchema: z.object({}),
        title: "Export PDF",
      },
      async () => {
        try {
          const result = await pinch("GET", "/pdf");
          const text = typeof result === "string" ? result : toJson(result);
          return { content: [{ text, type: "text" as const }] };
        } catch (error) {
          return toolError(error);
        }
      },
    );
  • Schema/definition for 'pinchtab_pdf' — takes no input parameters, returns base64 PDF data.
    {
      description: "Export the current page as a PDF. Returns the PDF as base64.",
      inputSchema: z.object({}),
      title: "Export PDF",
  • The 'pinch' helper function called by the handler — makes HTTP requests to the PinchTab server; the pdf handler calls pinch('GET', '/pdf').
    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();
    }
  • The toolError helper used in the catch block of the pdf handler to format errors as MCP tool error responses.
    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,
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description should disclose behavioral traits. It only says it exports PDF and returns base64. It omits side effects, error conditions, whether it requires a loaded page, or any rate limits. Insufficient for fully informed use.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with no fluff. Each sentence provides essential information: action and output format. Efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple nature (no params, no output schema), the description is fairly complete. It specifies the action and return format. However, 'current page' assumes knowledge of the tab context from sibling tools, and could be more explicit about what constitutes the 'current page'.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters, and schema coverage is 100%. Per guidelines, 0 parameters yields a baseline of 4. The description adds no parameter info because none exist.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action: 'Export the current page as a PDF' and the return format 'Returns the PDF as base64.' It uses a specific verb and resource, and is distinct from sibling tools which are all browser interactions (click, navigate, etc.).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives, prerequisites (e.g., a page must be loaded), or when not to use it. There is no contextual information to help an agent decide.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/maderwin/pinchtab-mcp'

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