Skip to main content
Glama
sandraschi

pdf-mcp

pdf_classify

Read-only

Detect PDF document types like invoices, reports, or contracts and extract candidate fields including invoice number, total, date, and vendor. Optionally refine results with a local LLM.

Instructions

Guess the document type (invoice, report, contract, ...) and extract candidate fields.

Return Format

A dict with keys:

  • success: bool

  • doc_type: str

  • confidence: float (0-1)

  • fields: dict of detected fields (invoice_number, total, date, vendor)

  • reasons: list of matched signals

  • llm_refined: bool - whether the local LLM confirmed the guess

Examples

await pdf_classify(path="invoice_42.pdf") {"success": true, "doc_type": "invoice", "confidence": 0.75, "fields": {"invoice_number": "INV-42", "total": "1,240.00"}, "reasons": ["invoice(x2)"]}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the PDF file.
refineNoUse the local LLM to refine the guess. Default true.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageNoHuman-readable summary
successNoWhether the operation succeeded

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

B3.2/5.0
Behavior3/5

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

The readOnlyHint annotation already establishes a safe read operation, so the bar is lower. The description adds useful behavioral context: it is a heuristic guess with a confidence score, optional local-LLM refinement, and matched reasons. It does not disclose cost/latency implications of the LLM refinement or processing limits.

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?

Purpose is front-loaded in one sentence, followed by a compact return-format block and a concrete example. The structure is efficient and example-driven, though the verbose return-key listing partially duplicates what the output schema already provides.

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

Completeness3/5

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

An output schema exists, so return values needn't be fully explained, yet the description is otherwise complete for invocation and interpretation. The notable gap is selection context: nothing tells the agent how this differs from sibling extraction/analysis tools.

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 100%, so path and refine are already documented. The return-format section explains that llm_refined reflects the refine flag, which adds some cross-field meaning, but the description does not extend parameter semantics beyond the schema.

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 states a specific verb (classify/guess) and resource (document type) with concrete examples of types and extracted fields, so an agent understands the operation. It does not, however, differentiate itself from close siblings like pdf_extract or pdf_analyze, which also surface document fields.

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 guidance or reference to alternatives. With siblings pdf_extract, pdf_analyze, and pdf_validate present, the agent gets no signal about when classification is preferable to generic extraction.

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