Skip to main content
Glama

list_equations

Extract mathematical equations from Word documents and convert them to LaTeX format for analysis or reuse.

Instructions

List all mathematical equations/formulas in a Word document.

Extracts equations stored in Office Math Markup Language (OMML) format and converts them to LaTeX notation for readability.

Args: filepath: Path to the document

Returns: Dictionary with list of equations including LaTeX representation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The 'list_equations' tool handler is implemented in src/docx_mcp/server.py. It uses '@app.tool()' decorator to register the tool and calls 'extract_equations' to perform the logic.
    @app.tool()
    def list_equations(filepath: str) -> dict[str, Any]:
        """
        List all mathematical equations/formulas in a Word document.
    
        Extracts equations stored in Office Math Markup Language (OMML) format
        and converts them to LaTeX notation for readability.
    
        Args:
            filepath: Path to the document
    
        Returns:
            Dictionary with list of equations including LaTeX representation
        """
        logger.info("Listing equations", extra={"tool": "list_equations", "filepath": filepath})
    
        try:
            equations = extract_equations(filepath)
    
            return {
                "status": "success",
                "filepath": filepath,
                "equations": [
                    {
                        "index": eq["index"],
                        "paragraph_index": eq["paragraph_index"],
                        "type": eq["type"],
                        "latex": eq["latex"],
                        "context": eq["context"],
                    }
                    for eq in equations
                ],
                "count": len(equations),
            }
        except DocxMcpError as e:
            logger.warning(e.message, extra={"tool": "list_equations", "error_code": e.error_code})
            return {"status": "error", "error": e.message, "error_code": e.error_code}
        except Exception as e:
            logger.error(f"Unexpected error listing equations: {str(e)}")
            return {"status": "error", "error": str(e)}
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions extraction and conversion behaviors but lacks details on permissions, file format support, error handling, or rate limits. For a tool that reads and processes files, this is a significant gap in behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded, starting with the core purpose. Each sentence adds value: the first states what it does, the second explains the technical process, and the third outlines inputs and outputs. There is no wasted text.

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?

Given the tool's moderate complexity (file processing with format conversion), the description covers the purpose, process, and return format. With an output schema present, it doesn't need to detail return values. However, it lacks context on limitations or dependencies, leaving some gaps.

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?

The description adds meaningful context for the single parameter 'filepath' by specifying it as a 'Path to the document', which clarifies its role beyond the schema's type. With 0% schema description coverage and only one parameter, this compensation is effective, though not exhaustive.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('List', 'Extracts', 'converts') and resources ('mathematical equations/formulas in a Word document'). It distinguishes from siblings by focusing on equations, unlike tools for images, styles, or document manipulation.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as needing a valid Word document with equations, or compare it to sibling tools like 'get_equation' or 'list_docx' for broader document listing.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Andrew82106/LLM_Docx_Agent_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server