Skip to main content
Glama

pdf_extract

Extract a PDF page's text, shapes, and images with exact coordinates, colors, and vector paths to rebuild the original design layout.

Instructions

抽取 PDF 某一页的全部内容,用于从 PDF 精确还原设计稿:

  • text:文本片段(字符串、基线坐标 x/y、宽高、字号、旋转角、颜色、外框 bbox)

  • shapes:矢量图形(填充/描边色、透明度、线宽、外框 bbox、以及子路径几何:M/L/C/Q/Z 线段;paint="clip" 是不可见的裁剪区)

  • images:位图贴图(外框 bbox、原始像素尺寸、对象名) 坐标:左上原点、y 向下、单位 pt(1pt=1/72 英寸)。 注意:Chrome/Skia 导出的 PDF 常把可见文字画成矢量轮廓,另垫一层不可见的文本对象;这类文本会被标 "covered":true,颜色则由同位置的轮廓反推并标 "colorFrom":"outline"。 建议先整体抽取一次看清结构,图形很多时用 detail="box" 只取外框与样式,再对重点区域用 pdf_extract + pdf_render 局部细看。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageYes页码,从 1 开始
pathYesPDF 文件路径(绝对或相对当前工作目录)
limitNo每类结果条数上限,默认 5000
detailNo图形细节级别:full(默认)含完整路径线段;box 只给外框+样式,输出更小
includeNo只返回指定类别,默认全部
passwordNo若 PDF 已加密,提供打开密码
precisionNo坐标保留小数位,默认 3

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/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 succeeds. It discloses the coordinate system (top-left origin, y down, pt units), the Chrome/Skia quirk where visible text is rendered as vector outlines with an invisible text layer (marked 'covered':true and color inferred via 'colorFrom':'outline'), and clarifies that paint='clip' represents invisible clipping regions. These non-obvious traits are exactly what an agent needs to interpret output safely.

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?

The description is long but well-structured, with a one-line purpose, bullet lists for content categories, a coordinate note, a quirk note, and a usage recommendation. Each section provides necessary context for a complex extraction tool, so the length is justified, though a bit dense. The core purpose is front-loaded.

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 there is no output schema and no annotations, the description does a strong job of explaining what the tool returns (categories, attributes, coordinate conventions) and common rendering pitfalls. It does not explicitly cover error behavior such as out-of-range pages or corrupted/encrypted files, but the password parameter is already documented in the schema. Overall, an agent has enough to invoke the tool correctly.

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?

Schema description coverage is 100%, so the baseline is 3. The description mostly repeats what the schema already states about detail ('box' vs 'full') in the usage recommendation ticket, and it adds no meaningful new semantics for path, page, limit, include, password, or precision. The schema is the primary source for parameter meaning.

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 clear verb and resource: '抽取 PDF 某一页的全部内容' (extract all content of a given PDF page). It then enumerates the three output categories (text, shapes, images) with their specific attributes, making the tool's purpose concrete and easily distinguishable from the sibling pdf_info and pdf_render tools.

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 final paragraph gives explicit workflow guidance: extract the whole page first, use detail='box' when shapes are numerous, and combine pdf_extract with pdf_render for focused inspection. This provides clear context and references a sibling tool for a complementary use, though it never explicitly says when to prefer pdf_info over pdf_extract.

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