Skip to main content
Glama

Search PDF Text

search_text
Read-onlyIdempotent

Search for text in a PDF file with case-insensitive matching. Specify a page range or search the entire document to get matches with surrounding context and page numbers.

Instructions

Search for text within a PDF document. Returns matching locations with surrounding context.

Case-insensitive search across all or specified pages. Each match includes the page number, the matched text, and configurable surrounding context.

Args:

  • file_path (string): Absolute path to a local PDF file

  • query (string): Text to search for (case-insensitive, 1-500 chars)

  • pages (string, optional): Page range to search. Omit for all pages.

  • context_chars (number): Characters of context before/after match (default: 80)

  • max_results (number): Maximum matches to return (default: 20, max: 100)

  • response_format ('markdown' | 'json'): Output format (default: 'markdown')

Returns: Search matches with page number, matched text, and surrounding context.

Examples:

  • Search entire PDF: { file_path: "/path/to/doc.pdf", query: "digital signature" }

  • Search specific pages: { file_path: "/path/to/doc.pdf", query: "error", pages: "1-10" }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to a local PDF file (e.g., "/path/to/document.pdf")
queryYesText to search for (case-insensitive)
pagesNoPage range to process. Format: "1-5", "3", or "1,3,5-7". Omit for all pages.
context_charsNoNumber of characters to show before and after each match
max_resultsNoMaximum number of matches to return
response_formatNoOutput format: "markdown" for human-readable, "json" for structured datamarkdown
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the description adds value by detailing case-insensitivity, context output, page range support, and configurable limits. It could mention performance implications for large PDFs, but overall it provides good behavioral insight beyond annotations.

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 purpose sentence, clear parameter list (Args), return description, and practical examples. Every sentence is informative and earns its place.

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 6 parameters, no output schema, and the presence of sibling tools, the description is complete. It covers all parameter details, return format, examples, and edge cases (like all pages vs. specific pages).

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?

With 100% schema description coverage, the schema already documents each parameter. However, the description adds examples, default values, and constraints (e.g., query length, context_chars range) that enhance understanding beyond the 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's purpose: 'Search for text within a PDF document. Returns matching locations with surrounding context.' This specifies the verb (search), resource (PDF text), and output, distinguishing it from sibling tools like read_text (extracts all text) or inspect_structure.

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 clear context for usage: it performs case-insensitive search across all or specified pages, and offers examples. It does not explicitly exclude scenarios or mention alternatives, but the context of sibling tools implies its specialized role.

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

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