Skip to main content
Glama

sympy_factorint

Factorize an integer into its prime factors. Input an integer to obtain its prime factorization output.

Instructions

Integer factorization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYesInteger

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the sympy_factorint tool. Takes an integer as string, calls sympy.factorint(int(n)) to compute prime factorization, and returns the result as a string.
    def sympy_factorint(n: str) -> str:
        """Integer factorization.
    
        Args:
            n: Integer
    
        Returns:
            Prime factorization as string
    
        Example:
            >>> sympy_factorint("12")
            "{2: 2, 3: 1}"
        """
        return str(sympy.factorint(int(n)))
  • The @mcp.tool() decorator that registers sympy_factorint as an MCP tool on the FastMCP server instance.
    @mcp.tool()
  • The _sympify helper function used by other tools (though sympy_factorint uses int() directly for parsing).
    def _sympify(expr: str) -> sympy.Basic:
        """Convert string expression to SymPy object."""
        return sympy.sympify(expr)
  • The docstring serves as the schema/interface definition: expects a string argument 'n' representing an integer, returns a string representation of the prime factorization dict.
    """Integer factorization.
    
    Args:
        n: Integer
    
    Returns:
        Prime factorization as string
    
    Example:
        >>> sympy_factorint("12")
        "{2: 2, 3: 1}"
    """
Behavior1/5

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

With no annotations, the description carries full burden. It merely states 'Integer factorization' with no mention of algorithm, side effects, return behavior, or constraints. Lacks any useful behavioral detail.

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

Conciseness3/5

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

Extremely concise at 2 words, but this brevity sacrifices essential details. It is not well-structured or front-loaded with key information.

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

Completeness2/5

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

Despite a simple parameter and existence of an output schema, the description fails to explain what the function returns (e.g., a dictionary of prime factors). An AI agent needs more context to use the tool correctly.

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

Parameters2/5

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

Schema coverage is 100% but the only parameter 'n' has a minimal description 'Integer'. The tool description adds nothing, merely restating the purpose. No parameter formatting, range, or example provided.

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

Purpose3/5

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

The description 'Integer factorization' clearly states the purpose. However, it does not differentiate from sibling tools like sympy_factor or other number theory tools, which could cause confusion.

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 on when to use this tool versus alternatives like sympy_factor or sympy_isprime. The agent has no context for selection.

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