Skip to main content
Glama

sympy_expand_log

Expand logarithmic expressions into a sum of simpler logarithms using symbolic algebra.

Instructions

Expand logarithmic expressions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exprYesString logarithmic expression

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the sympy_expand_log tool. It takes a string expression, converts it to a SymPy object via _sympify (which calls sympy.sympify), then applies sympy.expand_log, and returns the result as a string.
    @mcp.tool()
    def sympy_expand_log(expr: str) -> str:
        """Expand logarithmic expressions.
    
        Args:
            expr: String logarithmic expression
    
        Returns:
            Expanded expression
    
        Example:
            >>> sympy_expand_log("log(x*y)")
            "log(x) + log(y)"
        """
        return str(expand_log(_sympify(expr)))
  • The tool is registered via the @mcp.tool() decorator on the FastMCP instance 'mcp' (created at line 119: mcp = fastmcp.FastMCP('mcp-sympy')).
    @mcp.tool()
  • Helper function _sympify converts input string to a SymPy object using sympy.sympify, used by the handler.
    def _sympify(expr: str) -> sympy.Basic:
        """Convert string expression to SymPy object."""
        return sympy.sympify(expr)
  • Input/output schema is defined by the function signature: takes a string (expr) and returns a string.
    @mcp.tool()
    def sympy_expand_log(expr: str) -> str:
        """Expand logarithmic expressions.
    
        Args:
            expr: String logarithmic expression
    
        Returns:
            Expanded expression
    
        Example:
            >>> sympy_expand_log("log(x*y)")
            "log(x) + log(y)"
        """
        return str(expand_log(_sympify(expr)))
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states 'expand logarithmic expressions' without detailing what expansion entails, whether it applies product/quotient/power rules, or any side effects. Minimal transparency.

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 a single concise sentence, front-loading the core purpose. However, it could include a brief example or mention of expansion rules.

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?

For a simple tool with one well-described parameter and output schema, the description is adequate but lacks usage context. It does not explain what 'expand' entails or when it's appropriate, leaving the agent to infer.

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

Parameters3/5

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

Schema description coverage is 100% for the single parameter 'expr', which is described as 'String logarithmic expression'. The description adds no further meaning beyond the schema, so baseline 3 is appropriate.

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 'Expand logarithmic expressions' clearly states the action (expand) and the target (logarithmic expressions). It distinguishes this tool from siblings like sympy_simplify, sympy_expand (general), and sympy_log, which are specific to logs.

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?

No guidance on when to use this tool over alternatives such as sympy_expand (for general expansion) or sympy_simplify. No prerequisites or exclusions provided.

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/daedalus/mcp-sympy'

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