sympy_acos
Compute the arc cosine (inverse cosine) of a numerical expression between -1 and 1 using symbolic mathematics.
Instructions
Arc cosine.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes | Expression (between -1 and 1) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:1209-1223 (handler)The handler function for the sympy_acos MCP tool. It takes a string expression, convert it to a SymPy object via _sympify, computes the arc cosine via sympy.acos, and returns the result as a string.
@mcp.tool() def sympy_acos(expr: str) -> str: """Arc cosine. Args: expr: Expression (between -1 and 1) Returns: acos(expr) as string Example: >>> sympy_acos("1") "0" """ return str(acos(_sympify(expr))) - src/mcp_sympy/tools.py:1210-1217 (schema)Input schema: takes a single string parameter 'expr'. Output: returns a string.
def sympy_acos(expr: str) -> str: """Arc cosine. Args: expr: Expression (between -1 and 1) Returns: acos(expr) as string - src/mcp_sympy/tools.py:1209-1209 (registration)The tool is registered with the FastMCP server via the @mcp.tool() decorator on line 1209.
@mcp.tool() - src/mcp_sympy/tools.py:114-116 (helper)Helper function _sympify that converts a string expression to a SymPy object, used by sympy_acos to parse the input expression.
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr) - src/mcp_sympy/tools.py:49-51 (helper)The acos function is imported from sympy at line 49, which is the underlying symbolic arc cosine function used in sympy_acos.
acos, asin, atan,