Skip to main content
Glama
Xvvln

io.github.Xvvln/pdf-reader-mcp

by Xvvln

read_pdf_as_images

Convert PDF pages to base64-encoded images while retaining original layout, charts, and formulas. Select specific pages, resolution, format, and compression.

Instructions

将PDF页面转换为图片(base64编码)返回。适合需要保留原始排版、图表、公式的场景。

Args: file_path: PDF文件的完整路径 pages: 要读取的页码,支持多种格式: - 不传或"all": 所有页面 - "1": 单页 - "1-5": 页码范围 - "1-": 从第1页到末尾 - "-5": 从开头到第5页 - "1,3,5": 指定多页 - "1-3,5,7-9": 混合格式 dpi: 图片分辨率,默认150。72=低质量小文件,150=平衡,300=高清大文件 image_format: 图片格式,"jpeg"(默认,文件小)或"png"(无损,文件大) quality: JPEG压缩质量(1-100),默认85。仅对jpeg格式有效,值越低文件越小但质量越差 max_total_bytes_mb: 单次调用允许返回的最大图片负载(MB),默认20

Returns: 图片列表,每个元素包含: - page_number: 页码(从1开始) - image_base64: 图片的base64编码 - width: 图片宽度(像素) - height: 图片高度(像素) - format: 图片格式 - truncated: 是否因大小限制被截断 - warning: 截断或限制提示(可选)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dpiNo
pagesNo
qualityNo
file_pathYes
image_formatNojpeg
max_total_bytes_mbNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description fully discloses behavior: images are base64 encoded, return structure includes page number, dimensions, format, and truncation info. It explains the max_total_bytes_mb limit and that quality only applies to jpeg, giving agents full awareness of output characteristics and constraints.

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?

The description is well-structured: a concise summary sentence followed by Args and Returns sections. Each sentence adds essential information without redundancy. Despite length, it is efficiently organized and front-loaded with the core purpose, making it easy for an agent to scan.

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

Completeness5/5

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

Given the complexity of 6 parameters and no annotations, the description thoroughly covers all inputs (including edge cases like mixed page formats) and outputs (including truncated and warning fields). The output schema exists, but the description still explains return elements, making the tool fully understandable.

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

Parameters5/5

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

The input schema has 0% description coverage, so the description provides all parameter semantics. It explains file_path requirement, pages format (with examples), dpi trade-offs, image_format defaults, quality range and exclusive jpeg applicability, and max_total_bytes_mb. This adds significant value beyond the raw schema.

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 tool converts PDF pages to base64 images, specifies the verb and resource, and explicitly mentions suitable scenarios (retaining layout, charts, formulas), distinguishing it from sibling tools like read_pdf_as_text.

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?

The description provides context on when to use the tool (scenarios needing original layout) and includes detailed parameter usage guidance. It does not explicitly exclude cases or name alternatives, but the purpose and sibling list imply when to choose this over text or other extraction tools.

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/Xvvln/pdf-reader-mcp'

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