Skip to main content
Glama

pdf_extract_patterns

Scan PDFs for custom keywords and regex patterns, returning each match with surrounding context as JSON for document review and data extraction.

Instructions

Extract Keywords & Patterns: Scan document for custom keywords and regex patterns with match contexts [Input: .pdf | Output: .json]

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "input": "<input>"
    },
    "name": "pdf_extract_patterns"
  }
}

Input Schema

NameRequiredDescriptionDefault
inputYes
outputNo
keywordsNoArray of keywords to search for across all pages
patternsNoKey-value map of pattern label to regex string (e.g. {"ssn": "\\d{3}-\\d{2}-\\d{4}"})
context_lenNoContext characters around match (default: 30)
case_sensitiveNoWhether matching should be case-sensitive (default: false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden, yet it only states the input/output formats and that match contexts are returned. It says nothing about permissions, handling of encrypted or scanned PDFs, page limits, behavior when zero matches are found, or how the JSON results are shaped. For an unannotated tool this is a significant disclosure gap.

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?

A single front-loaded clause plus a bracketed format tag — zero filler and the key action comes first. It is arguably too terse for the tool's complexity, but nothing is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With six parameters, a nested pattern map, no annotations, and no output schema, the description should explain result structure and the meaning of the output path. Instead it stops at format tags, leaving the agent without enough to predict the returned JSON or the full effect of its arguments.

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 coverage is a middling 67%, and the description reinforces the core parameters (keywords, patterns, match context) plus the .pdf-in/.json-out convention. However, it adds no detail on context_len units/default, case_sensitive behavior, or what the 'output' path parameter expects, so it does little beyond what the schema already documents.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a concrete verb-plus-resource ('Scan document for custom keywords and regex patterns with match contexts') and even labels the input and output formats, so an agent can tell this is a content-search tool rather than a plain text extractor. It stops short of naming a sibling like pdf_extract_text to sharpen the boundary, so it lands at 4 rather than 5.

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

Usage Guidelines2/5

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

There is no explicit when-to-use or when-not-to-use guidance and no mention of the obvious alternative (pdf_extract_text) for agents that just want raw text. The intended use is only implied by the tool's phrasing, leaving the agent to infer that this is for targeted keyword/regex lookup rather than full extraction.

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