Skip to main content
Glama

extract_formulas

Extract formulas from PDF pages, delivering LaTeX code, PNG renderings, and optional SymPy validation for structured mathematical content.

Instructions

extract_formulas tool:公式抽取(LaTeX + PNG,M5,T04)。

Args: pdf_path: PDF 路径(必填)。 pages: 页号(int | list[int] | None;1-based)。 render: 是否渲染 PNG(bool,默认 true)。 tex: 是否落盘 formulas.tex(bool,默认 false)。 sympy: 是否做 SymPy 校验(bool,默认 false)。

Returns: 结构化 JSON 文本(formulas.json 汇总)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
texNo
pagesNo
sympyNo
renderNo
pdf_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

A3.6/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It does disclose the effects of render (PNG), tex (writes formulas.tex), sympy (validation), and the JSON return type. However, it does not state where rendered PNG files are written, whether files can be overwritten, or whether the operation is safe/non-destructive, leaving the behavioral picture incomplete.

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 compact and well-structured with labeled Args and Returns sections, and each parameter is on a single scannable line. Some space is wasted on the redundant 'extract_formulas tool' header and the unexplained 'M5, T04' code, but overall it is efficient.

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

Completeness4/5

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

For a five-parameter extraction tool with no annotations, the description covers all input semantics and the return type, and an output schema is present so return details need not be expanded. It lacks usage routing and PNG file-destination details, but an agent has most of the information needed to invoke it correctly.

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?

Schema description coverage is 0%, but the Args section fully compensates: all five parameters receive a semantic explanation, type, default, and for pages a 1-based convention. This adds substantial meaning beyond the bare schema and leaves no parameter ambiguous.

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 the action '公式抽取' (formula extraction) and the output modes 'LaTeX + PNG', making the tool's function specific and distinct from siblings like extract_table and parse_text. It is not a mere tautology, though it never explicitly contrasts with a sibling and includes cryptic 'M5/T04' identifiers.

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 about when to choose extract_formulas over siblings such as vision_extract, dual_extract, or parse_text, and no exclusions or prerequisites beyond requiring pdf_path. The intended use case is only implied by the tool name and the phrase 公式抽取, not explicitly stated.

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