Skip to main content
Glama

sympy_matrix

Construct a matrix by specifying rows separated by semicolons, enabling symbolic mathematical operations.

Instructions

Create a matrix from rows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYesSemicolon-separated rows, e.g., "1,2; 3,4"

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function for the 'sympy_matrix' tool. Takes a semicolon-separated string of rows, splits into a 2D list of integers, and creates a sympy Matrix, returning it as a string.
    @mcp.tool()
    def sympy_matrix(rows: str) -> str:
        """Create a matrix from rows.
    
        Args:
            rows: Semicolon-separated rows, e.g., "1,2; 3,4"
    
        Returns:
            Matrix as string
    
        Example:
            >>> sympy_matrix("1,2; 3,4")
            "Matrix([[1, 2], [3, 4]])"
        """
        row_list = [r.split(",") for r in rows.split(";")]
        matrix_data = [[int(x.strip()) for x in row] for row in row_list]
        return str(Matrix(matrix_data))
  • The @mcp.tool() decorator registers 'sympy_matrix' as a FastMCP tool on the 'mcp-sympy' server.
    @mcp.tool()
  • The 'mcp' FastMCP server instance used to register all tools via the @mcp.tool() decorator.
    mcp = fastmcp.FastMCP("mcp-sympy")
  • Module docstring and imports. The 'sympy_matrix' handler uses 'Matrix' imported from sympy on line 26.
    """MCP tools that expose SymPy's symbolic mathematics functionality."""
  • Test for sympy_matrix creation, verifying the output contains 'Matrix'.
    def test_matrix_creation(self):
        """Test matrix creation."""
        result = tools.sympy_matrix("1,2; 3,4")
        assert "Matrix" in result
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description carries full burden for behavioral disclosure. It only states 'Create a matrix from rows' without mentioning input constraints, error behavior, or symbolic nature. This is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of five words, extremely concise and focused. Every word contributes to stating the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While the schema and output schema may suffice for simple use, the lack of usage guidelines and behavioral details makes the description minimally complete for the complexity and sibling set.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with a clear description for the 'rows' parameter including an example format. The tool description adds no new information, so it meets the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a matrix from rows' clearly states the verb (create), resource (matrix), and the specific method (from rows). It effectively distinguishes from sibling tools like sympy_eye, sympy_ones, etc., which create matrices differently.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as sympy_diag, sympy_eye, or sympy_zeros. Given the large number of sibling matrix tools, explicit usage context is missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/daedalus/mcp-sympy'

If you have feedback or need assistance with the MCP directory API, please join our Discord server