Skip to main content
Glama
PDF MCP Server
by oriondean

upload_pdf_to_gemini

Fetches a PDF from a URL, renders its pages as images, and uploads them to Google Gemini for visual analysis of charts, diagrams, tables, and layouts using your custom prompt.

Instructions

Fetches a PDF from a URL, renders it as images, and uploads to Google Gemini for advanced visual processing and analysis with a custom prompt. Gemini can analyze charts, diagrams, tables, handwriting, and complex visual layouts that traditional text extraction might miss. Requires GOOGLE_API_KEY or GEMINI_API_KEY environment variable. Best for visually complex documents, forms, presentations, or documents with mixed content.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "url": "<url>",
      "prompt": "<prompt>"
    },
    "name": "upload_pdf_to_gemini"
  }
}

Input Schema

NameRequiredDescriptionDefault
dpiNoDPI for image rendering (72-300, default 150)
urlYesURL of the PDF to fetch and upload to Gemini
modelNoGemini model to use for visual processinggemini-3-pro
pagesNoSpecific page numbers to upload (optional)
promptYesPrompt to send to Gemini for analyzing the PDF. Describe what you want to extract or understand from the document.
maxPagesNoMaximum number of pages to upload to Gemini (1-50, default 20)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden, and it does real work: it discloses that the PDF is fetched from a URL, rendered to images at a DPI, and sent to an external service (Gemini), and that an API key (GOOGLE_API_KEY or GEMINI_API_KEY) is required. It does not discuss cost, latency, data retention, or failure behavior for an external-API tool, keeping it out of 5 territory.

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

Conciseness4/5

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

Four sentences, front-loaded with the mechanism, then guidance. Slight redundancy in 'advanced visual processing and analysis', and the requirement sentence could sit earlier, but there is no padding overall.

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

Completeness3/5

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

For a six-parameter tool with no annotations and no output schema, the description covers the mechanism, prerequisites, and use case, but never indicates what Gemini returns (text answer, page-by-page analysis, errors on oversized PDFs). An agent must guess at the return shape and at how partial failures are handled.

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

Parameters3/5

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

All six parameters already have schema descriptions at 100% coverage, so the schema does the heavy lifting. The description adds only the notion of a 'custom prompt' and page rendering, without clarifying interaction effects such as how pages and maxPages combine or how dpi affects output quality versus cost.

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

Purpose4/5

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

States a concrete pipeline: fetch PDF from URL, render pages as images, send to Gemini with a custom prompt for visual analysis. This is clearly a distinct capability from plain text extraction, which the description also names ('traditional text extraction might miss'), giving implicit differentiation from the fetch_and_parse_pdf sibling without naming it directly.

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

Usage Guidelines4/5

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

Explicitly states when to use it: 'Best for visually complex documents, forms, presentations, or documents with mixed content.' The implicit when-not case is text extraction, but there is no explicit exclusion clause pointing the agent elsewhere for plain-text PDFs, so it stops short of a 5.

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

Deploy Server

Other Tools