Skip to main content
Glama
Xvvln

io.github.Xvvln/pdf-reader-mcp

by Xvvln

read_pdf_as_text

Extract text from plain PDF files with page range selection and character limits for efficient processing.

Instructions

提取PDF的文本内容。适合纯文本PDF,速度快,消耗token少。

注意:对于扫描版PDF(图片PDF),此方法可能无法提取文本,建议使用read_pdf_as_images。

Args: file_path: PDF文件的完整路径 pages: 要读取的页码,支持多种格式: - 不传或"all": 所有页面 - "1": 单页 - "1-5": 页码范围 - "1-": 从第1页到末尾 - "-5": 从开头到第5页 - "1,3,5": 指定多页 - "1-3,5,7-9": 混合格式 max_pages: 单次调用最多返回的页数,默认50 max_chars: 单次调用最多返回的总字符数,默认200000

Returns: 包含以下信息的字典: - total_pages: 总页数 - extracted_pages: 提取的页码列表 - pages: 每页内容列表,包含page_number和text - full_text: 所有页面的合并文本 - warning: 警告信息(如检测到可能是扫描版PDF或结果被截断)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pagesNo
file_pathYes
max_charsNo
max_pagesNo
Behavior5/5

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

No annotations are provided, so the description carries full burden. It discloses speed, low token consumption, limitation to text PDFs, and includes warnings for scanned PDF detection and truncation. The return structure is also described.

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 well-structured with separate sections for purpose, args, and returns. It is front-loaded with the main purpose and limitations. However, it is somewhat lengthy; slight trimming could improve conciseness without losing value.

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 tool has 4 parameters and no output schema, the description fully covers the return dictionary, potential warnings, and parameter behavior. It addresses edge cases like scanned PDFs and result truncation, making it complete for the tool's complexity.

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?

Schema description coverage is 0%, but the description compensates with detailed explanations of pages, max_pages, and max_chars. The pages parameter is especially well-documented with multiple format examples. The file_path parameter is minimally described, but the schema title is clear.

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 extracts text content from PDFs, specifying it is suitable for text PDFs and distinguishing it from read_pdf_as_images for scanned PDFs. The verb 'extract' and resource 'PDF text' are specific, and the sibling differentiation is explicit.

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

Usage Guidelines5/5

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

The description provides explicit guidance: suitable for text PDFs, not for scanned PDFs, and recommends the alternative tool read_pdf_as_images for scanned PDFs. It also explains the pages parameter in detail, helping the agent understand how to use it correctly.

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