Skip to main content
Glama

Search text

search_pdf
Read-only

Find every occurrence of a word or phrase in a PDF and return the match count plus page and line locations. Use it to locate text without reading the whole document.

Instructions

Finds every occurrence of a word or phrase in a PDF and returns the count and, for each match, the page number and the line it is on (up to 500). Matching is literal text (no wildcards or regular expressions), case-insensitive by default and Turkish İ/ı aware; a phrase is found within one line of text. Use it to locate something without reading the whole document; to read pages use extract_text, and to black out what was found use redact_pdf with the same words. Scanned pages have no text and give no matches until recognize_text is run. Read-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path of the PDF.
queryYesWord or phrase to find, as plain text.
passwordNoPassword, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it.
match_caseNoOnly match the exact upper/lower case (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.9
    • addedInput schema / properties / match_case / description
      Added value: +"Only match the exact upper/lower case (default false)."
    • changedInput schema / properties / password / description
      Previous value: -"Password, if the PDF is encrypted."New value: +"Password, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it."
    • addedInput schema / properties / query / description
      Added value: +"Word or phrase to find, as plain text."
  2. First observedv1.0.6

TDQS

A4.9/5.0
Behavior5/5

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

Despite readOnlyHint already covering safety, the description adds substantial behavior: literal-only matching (no wildcards/regex), case-insensitive default with Turkish İ/ı awareness, phrase matching constrained to a single line, a 500-match cap, and the scanned-page limitation. These are non-obvious traits that materially affect expectations.

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?

A single dense paragraph, front-loaded with what the tool returns, followed by matching semantics and then routing to siblings. Every clause carries information an agent needs; nothing is redundant boilerplate.

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?

With no output schema, the description steps in to describe the return values (count, page number, line, capped at 500) and covers the encrypted-PDF password caveat via the schema. Nothing essential to calling this correctly is missing.

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 coverage is 100%, so the baseline is 3. The description nonetheless adds meaning: it clarifies the default case-insensitivity that the match_case parameter toggles, states query is plain literal text, and explains matching is line-bounded, which the schema does not convey.

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?

States a specific verb and resource ('Finds every occurrence of a word or phrase in a PDF') and even specifies the return shape (count plus page number and line per match). It is immediately distinguishable from extract_text (reading pages) and redact_pdf (blacking out matches) which it names directly.

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?

Explicitly routes the agent: 'use it to locate something without reading the whole document; to read pages use extract_text, and to black out what was found use redact_pdf with the same words.' It also flags the when-not case for scanned pages, which require recognize_text first.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.