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

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)}

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