Skip to main content
Glama

parse_expression

Transform formulas into SymPy-computable expressions. Extracts symbols, equation status, and LaTeX for symbolic math workflows.

Instructions

    Parse a mathematical expression into SymPy-computable form.

    This tool converts human-readable formula notation into validated SymPy
    expressions, extracting symbols and their relationships.

    Args:
        expression: Mathematical expression (e.g., "v' = M1*v*cos(θ)/(M1+M2)")
        description: Optional description of what this formula represents
        symbol_hints: Optional hints for symbol types (e.g., {"m": "positive_real"})

    Returns:
        Parsed expression with:
        - sympy_expr: SymPy expression string
        - symbols: List of extracted symbols with inferred types
        - latex: LaTeX representation
        - is_equation: Whether it's an equation (has '=')

    Examples:
        parse_expression("F = m*a")
        → {"sympy_expr": "Eq(F, m*a)", "symbols": ["F", "m", "a"], ...}

        parse_expression("∫x²dx", description="Integral of x squared")
        → {"sympy_expr": "Integral(x**2, x)", ...}
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYes
descriptionNo
symbol_hintsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It does well by explaining the conversion process, that expressions are 'validated', and by detailing the return structure (sympy_expr, symbols, latex, is_equation) with examples. It does not, however, discuss potential failure modes or edge cases.

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 appropriately sized, with a clear top-line summary followed by Args, Returns, and Examples. Every section earns its place, and the content is front-loaded with the most important information.

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

Completeness5/5

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

The tool has a moderate complexity with 3 parameters and an output schema, and the description covers the purpose, all parameters, the return format, and provides two concrete examples. This is complete enough for an agent to select and invoke the tool correctly.

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 input schema has no descriptions for its properties, so the description must compensate. It does so by explaining each parameter in the Args section, providing examples for expression and symbol_hints, and clarifying that description is optional. This adds significant meaning beyond the raw schema types.

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 clearly states the tool's purpose: parsing a mathematical expression into a SymPy-computable form, and it mentions extracting symbols. However, it does not explicitly differentiate itself from sibling tools like validate_expression or extract_symbols, which may perform overlapping functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides examples and parameter details, implying it is used for converting human-readable formulas to SymPy. However, it does not explicitly state when to use this tool instead of alternatives, nor does it mention any exclusions or prerequisites.

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/u9401066/nsforge-mcp'

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