sympy_series
Compute series expansion of a mathematical expression symbolically, specifying variable, expansion point, and order.
Instructions
Compute series expansion.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes | String expression | |
| variable | No | Variable to expand around | x |
| point | No | Point to expand around | 0 |
| order | No | Order of expansion |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:431-449 (handler)The main handler function for sympy_series tool. It converts string inputs to SymPy objects and calls sympy.series() to compute the series expansion.
@mcp.tool() def sympy_series( expr: str, variable: str = "x", point: str = "0", order: int = 6 ) -> str: """Compute series expansion. Args: expr: String expression variable: Variable to expand around point: Point to expand around order: Order of expansion Returns: Series expansion as string """ var = sympy.Symbol(variable) pt = _sympify(point) result = series(_sympify(expr), var, pt, order) return str(result) - src/mcp_sympy/tools.py:431-434 (registration)The @mcp.tool() decorator registers sympy_series as an MCP tool on the FastMCP server instance.
@mcp.tool() def sympy_series( expr: str, variable: str = "x", point: str = "0", order: int = 6 ) -> str: - src/mcp_sympy/tools.py:432-434 (schema)The function signature defines the input schema: expr (str), variable (str, default 'x'), point (str, default '0'), order (int, default 6). The return type is str.
def sympy_series( expr: str, variable: str = "x", point: str = "0", order: int = 6 ) -> str: - src/mcp_sympy/tools.py:114-116 (helper)Helper function _sympify converts string expressions to SymPy objects, used by sympy_series to parse the input expression and point.
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr)