Skip to main content
Glama

pdf_render

Rasterize a PDF page to PNG or JPEG for layout review or close-up inspection. Render a specific page or a rectangular region at adjustable scale; returns image data or saves to file.

Instructions

把 PDF 某一页栅格化成图片(PNG/JPEG)。可用于:整体查看版面、放大局部核对细节、验证还原结果。

  • 默认返回图片本身(base64),Agent 可直接查看;给 save 则写入文件并只返回路径信息。

  • region 可只渲染局部([x0,y0,x1,y1],pt,左上原点),配合较大 scale 相当于「放大镜」。 坐标:左上原点、y 向下、单位 pt(1pt=1/72 英寸)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dpiNo目标 DPI,等价于 scale=dpi/72;与 scale 同时给出时以 dpi 为准
pageYes页码,从 1 开始
pathYesPDF 文件路径(绝对或相对当前工作目录)
saveNo保存到该路径(不给则直接返回图片内容)
scaleNo缩放倍数(相对 72dpi),默认 1
formatNo输出格式,默认 png
regionNo只渲染该矩形区域 [x0,y0,x1,y1],pt,左上原点
passwordNo若 PDF 已加密,提供打开密码
backgroundNo背景色,默认 "#ffffff";传 "transparent" 保留透明

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations provided, the description carries the full behavioral burden and largely succeeds: it discloses the default return mode (base64 image viewable by the agent), the save-alternative (writes file and returns only path info), the region subsetting behavior with the magnifier effect, and the full coordinate convention (top-left origin, y-down, pt units). Minor gaps remain around error behavior (wrong password, invalid page number) and file-overwrite semantics, but the core behavior is clearly disclosed.

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?

Three tightly packed lines: the lead sentence states purpose and use cases, then two bullet-style lines cover return modes and region/coordinate semantics. Every sentence earns its place, key behavior is front-loaded, and there is zero filler or restatement of the schema.

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?

For a 9-parameter tool with no annotations and no output schema, the description covers the essentials an agent needs: return formats in both modes, region semantics, and coordinate units, while the schema handles dpi/scale precedence and default values. What's missing is error-behavior context (e.g., behavior on wrong password or out-of-range page) that would fully complete the picture for a tool with two required parameters.

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?

Schema description coverage is 100%, so the baseline is 3. The description nevertheless adds genuine value beyond the schema: it explains the region+scale synergy as a '放大镜' (magnifying glass), generalizes the coordinate system beyond the region parameter, and defines pt units (1pt=1/72 inch) — none of which the schema states. This justifies one point above baseline.

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 opens with a specific verb+resource+output: '把 PDF 某一页栅格化成图片(PNG/JPEG)' (rasterize a specific PDF page into an image). It further lists concrete use cases — viewing layout, zooming into details, verifying restoration results — which collectively distinguish it from the siblings pdf_info (metadata) and pdf_extract (content extraction) without ambiguity.

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?

Gives explicit use-context through '可用于:整体查看版面、放大局部核对细节、验证还原结果', telling the agent when rendering is the right operation. However, it never names the sibling alternatives (pdf_info/pdf_extract) nor states when NOT to use this tool, so it stops short of the explicit when/when-not/exclusion standard.

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