sympy_eq
Create a symbolic equality from two mathematical expressions. Use this to define equations for solving or simplification.
Instructions
Create equality.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lhs | Yes | Left-hand side | |
| rhs | Yes | Right-hand side |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:1830-1845 (handler)The sympy_eq tool handler: takes two string expressions (lhs, rhs), converts them to SymPy objects via _sympify, creates an Eq object, and returns its string representation.
@mcp.tool() def sympy_eq(lhs: str, rhs: str) -> str: """Create equality. Args: lhs: Left-hand side rhs: Right-hand side Returns: Equality as string Example: >>> sympy_eq("x", "y") "Eq(x, y)" """ return str(Eq(_sympify(lhs), _sympify(rhs))) - src/mcp_sympy/tools.py:1831-1831 (schema)The function signature serves as the input schema: it takes two strings (lhs and rhs) and returns a string.
def sympy_eq(lhs: str, rhs: str) -> str: - src/mcp_sympy/tools.py:1830-1830 (registration)The @mcp.tool() decorator registers sympy_eq as an MCP tool.
@mcp.tool() - src/mcp_sympy/tools.py:114-116 (helper)The _sympify helper converts string expressions to SymPy objects, used internally by sympy_eq.
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr)