sympy_conjugate
Compute the complex conjugate of a symbolic mathematical expression. Simplifies expressions involving complex numbers.
Instructions
Complex conjugate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:2209-2212 (handler)The function that implements the sympy_conjugate tool. It takes a string expression, converts it to a SymPy object via _sympify(), computes the complex conjugate using sympy.conjugate(), and returns the result as a string.
@mcp.tool() def sympy_conjugate(expr: str) -> str: """Complex conjugate.""" return str(sympy.conjugate(_sympify(expr))) - src/mcp_sympy/tools.py:114-116 (helper)The _sympify helper function that converts string expressions to SymPy objects, used by sympy_conjugate.
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr) - src/mcp_sympy/tools.py:2203-2206 (schema)Uses the @mcp.tool() decorator (defined via fastmcp.FastMCP on line 119) which registers the tool; the function signature (expr: str -> str) defines the input/output schema.
@mcp.tool() def sympy_rational(num: str, den: str) -> str: """Create Rational.""" return str(Rational(num, den))