Skip to main content
Glama

dual_extract

Extract structured fields, tables, and formulas from local PDFs using dual text-layout and vision extraction, with fusion adjudication to validate results.

Instructions

dual_extract tool:双路融合主入口(M3,T03)。

V2.0(additive):新增可选 verify_pages —— 调用级显式指定 OvisOCR2 校验页(信号②;未指定/未启用 → 触发规则自行判定,默认零调用)。

Args: pdf_path: PDF 路径(必填)。 fields: 字段键(str | list[str] | dict;必填,禁止空)。 pages: 页号(int | list[int] | None;1-based)。 model: 视觉模型名(可选,默认 Settings.ollama_model)。 think: 视觉路 thinking 开关(bool | None;None → Settings.ollama_think)。 field_types: {字段键: 字段类型}(可选;未指定按值形态推断)。 verify_pages: 页号(int | list[int] | None;1-based;OvisOCR2 校验页)。

Returns: 结构化 JSON 文本(ExtractionOutput)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNo
pagesNo
thinkNo
fieldsNo
pdf_pathYes
field_typesNo
verify_pagesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully reveals defaults (model, think, field_types inference) and the verify_pages fallback behavior ('默认零调用'). However, it does not disclose whether the operation is read-only, what the 'dual paths' actually are, or how errors or unsupported inputs are handled.

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-organized with a short intro, a version note, an Args list, and a Returns line. It is reasonably concise, though internal jargon such as '信号②', 'M3,T03', and '触发规则' adds noise without aiding an agent's decision-making.

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?

For a 7-parameter tool with no annotations, the description covers parameter semantics and output format well, and an output schema exists for return values. Yet key operational context is missing: what the two fusion paths are, what OvisOCR2 verification means in practice, and how this 'main entry' relates to the specialized sibling tools.

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?

Every parameter is given additional meaning not present in the schema: types, defaults, 1-based indexing, and requiredness. This compensates strongly for the 0% schema description coverage. The main flaw is that the description marks fields as mandatory while the input schema does not list it as required, creating ambiguity about invocation validity.

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 frames the tool as a dual-channel fusion main entry and, through the Args/Returns sections, conveys that it extracts structured JSON from PDFs using field keys and page selections. However, it never explicitly says 'extract fields from a PDF' and does not distinguish itself from siblings like vision_extract or extract_table.

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 guidance on when to use dual_extract versus vision_extract, parse_text, extract_table, or inspect_document. The only conditional language ('未指定/未启用 → 触发规则自行判定') concerns verify_pages defaults, not task-to-tool routing.

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