sympy_groebner
Simplify and solve systems of polynomial equations by computing their Groebner basis. Accepts a set of polynomial expressions as input.
Instructions
Groebner basis.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exprs | Yes | ||
| variable | No | x |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:2456-2460 (handler)The handler function for the sympy_groebner tool. Takes a comma-separated string of expressions and a variable, computes the Groebner basis using sympy.groebner(), and returns the result as a string.
@mcp.tool() def sympy_groebner(exprs: str, variable: str = "x") -> str: """Groebner basis.""" expr_list = [_sympify(e) for e in exprs.split(",")] return str(sympy.groebner(expr_list, _sympify(variable))) - src/mcp_sympy/tools.py:2456-2456 (registration)The tool is registered with the MCP server via the @mcp.tool() decorator on line 2456. The 'mcp' instance is created earlier in the file (line 119: mcp = fastmcp.FastMCP("mcp-sympy")).
@mcp.tool() - src/mcp_sympy/tools.py:114-116 (helper)Helper function _sympify is used within sympy_groebner to convert input strings into SymPy objects before computing the Groebner basis.
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr)