Skip to main content
Glama

sympy_derivative

Differentiate a symbolic expression with respect to a variable, with optional order, returning an unevaluated Derivative object.

Instructions

Create a Derivative object (unevaluated).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exprYesString expression
variableYesVariable to differentiate
orderNoOrder of derivative

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the sympy_derivative tool. It converts string expression and variable to SymPy objects and creates an unevaluated Derivative object.
    def sympy_derivative(expr: str, variable: str, order: int = 1) -> str:
        """Create a Derivative object (unevaluated).
    
        Args:
            expr: String expression
            variable: Variable to differentiate
            order: Order of derivative
    
        Returns:
            Derivative object as string
    
        Example:
            >>> sympy_derivative("x**2", "x")
            "Derivative(x**2, x)"
        """
        var = sympy.Symbol(variable)
        result = Derivative(_sympify(expr), var, order)
        return str(result)
  • Registration of the sympy_derivative function as an MCP tool via @mcp.tool() decorator on line 544.
    @mcp.tool()
  • The _sympify helper function used inside sympy_derivative to convert string expressions to SymPy objects.
    def _sympify(expr: str) -> sympy.Basic:
        """Convert string expression to SymPy object."""
        return sympy.sympify(expr)
  • The type annotations (expr: str, variable: str, order: int = 1) serve as the input schema for the tool.
    def sympy_derivative(expr: str, variable: str, order: int = 1) -> str:
        """Create a Derivative object (unevaluated).
    
        Args:
            expr: String expression
            variable: Variable to differentiate
            order: Order of derivative
    
        Returns:
            Derivative object as string
    
        Example:
            >>> sympy_derivative("x**2", "x")
            "Derivative(x**2, x)"
        """
        var = sympy.Symbol(variable)
        result = Derivative(_sympify(expr), var, order)
        return str(result)
Behavior2/5

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

No annotations provided, and description does not disclose behavioral traits such as input parsing, output format, or side effects. Minimal transparency beyond the name.

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?

Single sentence, concise, front-loaded with key information. No unnecessary words.

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?

With high schema coverage and output schema present, the description is minimal but sufficient for a simple creation tool. Could mention valid sympy expression syntax for extra completeness.

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 covers all parameters with descriptions, so description adds no extra meaning beyond schema. 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?

Description clearly states verb (Create) and resource (Derivative object), and distinguishes from sibling like sympy_diff by noting it is unevaluated.

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?

Implies usage when unevaluated derivative is needed, but does not explicitly name alternatives or state when not to use. The mention of 'unevaluated' gives some guidance.

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