Skip to main content
Glama
lihongwen

PDF Reader MCP Server

by lihongwen

search_pdf_text

Search for text in PDF documents and retrieve match locations, page numbers, and surrounding context.

Instructions

Search for text content across PDF pages with detailed match information.

Args:
    file_path: Path to PDF file
    query: Text to search for (or regex pattern if regex_search=True)
    pages: Page range (e.g., '1,3,5-10,-1') or None for all pages
    case_sensitive: Whether search is case-sensitive (default: False)
    regex_search: Whether to treat query as regex pattern (default: False)
    context_chars: Number of characters to show around matches (default: 100)
    max_matches: Maximum number of matches to return (default: 100)
    
Returns:
    JSON string with search results, match locations, and context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
queryYes
pagesNo
case_sensitiveNo
regex_searchNo
context_charsNo
max_matchesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are provided, so the description carries the burden of behavioral disclosure. It mentions that it returns 'JSON string with search results, match locations, and context' and specifies defaults for optional parameters. However, it omits details like error handling (e.g., invalid file path, malformed regex) or performance implications for large PDFs.

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 a brief intro followed by an Args list and a Returns line. It is concise but covers all important details. Minor redundancy: the Args list repeats parameter names already in the schema, but this is acceptable for clarity.

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 7 parameters, no annotations, and a complex tool, the description is fairly complete. It explains all parameters and return format. However, it lacks guidance on edge cases (e.g., query not found) and doesn't fully distinguish from siblings like 'find_and_highlight_text', which searches and highlights.

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% coverage (no descriptions), but the description's Args section explains all 7 parameters in detail, including format (e.g., page range '1,3,5-10,-1'), defaults, and behavior (e.g., 'context_chars: Number of characters to show around matches'). This fully compensates for the missing schema descriptions.

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's purpose: 'Search for text content across PDF pages with detailed match information.' It uses a specific verb ('Search') and a resource ('text content across PDF pages'), and distinguishes from siblings like 'find_and_highlight_text' (which highlights) and 'extract_page_text' (which extracts full text).

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

Usage Guidelines3/5

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

The description provides detailed parameter usage in the Args section, explaining how to use each option (e.g., page ranges, regex flag). However, it does not explicitly state when to use this tool over alternatives like 'extract_page_text' or 'find_and_highlight_text', nor does it provide any 'when to use' or 'when not to use' guidance.

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/lihongwen/pdfreadermcp'

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