Skip to main content
Glama

vision_extract

Extract specified fields from PDFs or images into structured JSON using a local vision model. Define fields to get only the needed data from documents.

Instructions

vision_extract tool:视觉路单跑。

V1.3:新增 image_path 参数(独立图片输入,与 pdf_path 互斥二选一)。

Args: pdf_path: PDF 路径(与 image_path 互斥;二者必传其一)。 fields: 字段键(str | list[str] | dict;必填)。 pages: 页号(int | list[int] | None;1-based;图片输入忽略)。 model: 模型名(可选,默认 Settings.ollama_model)。 image_path: 独立图片文件路径(PNG/JPG 等,V1.3 新增)。

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNo
pagesNo
fieldsNo
pdf_pathNo
image_pathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

B3/5.0
Behavior2/5

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

No annotations are present, so the description carries full burden for behavioral disclosure. It only mentions that pages is ignored for image input and that the return is structured JSON. It omits side effects, external model invocation, network/API usage, file format limitations, and error behavior, which are important for a vision-based extraction tool.

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 structured Arg/Returns layout is efficient and easy to scan. The version note about V1.3 image_path is slightly extraneous but not harmful; the summary phrase '视觉路单跑' is terse to the point of opacity.

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?

The description covers parameter semantics and return type, which is adequate given an output schema exists. However, it does not explain the actual extraction behavior, supported input formats beyond PNG/JPG, or how this tool fits among the sibling extraction/parsing tools. For a 5-parameter tool with no annotations, this leaves meaning gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The Args section documents every parameter with types, constraints, and defaults (e.g., pdf_path vs image_path mutual exclusivity, fields being required, pages being 1-based/ignored for images, model defaulting to Settings.ollama_model). This fully compensates for the 0% schema description coverage.

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

Purpose3/5

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

The first line '视觉路单跑' is a vague shorthand for visual waybill extraction rather than an explicit verb+resource statement. The Args/Returns sections imply an extraction task, and the tool name 'vision_extract' helps, but the description does not clearly define what the tool does or how it differs from siblings like extract_table or dual_extract.

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?

The description gives input constraints ('pdf_path and image_path are mutually exclusive and one must be provided'; 'pages ignored for image input') but never states when to choose this tool over sibling extractors, nor any scenario-based guidance. It is limited to parameter mechanics, not use-case routing.

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