Skip to main content
Glama

sympy_intersection

Compute the intersection of two symbolic sets, yielding the set of common elements.

Instructions

Compute intersection of two sets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
set1YesFirst set
set2YesSecond set

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler function for the 'sympy_intersection' tool. It takes two string-encoded sets, converts them to SymPy objects via _sympify, computes their Intersection, and returns the result as a string.
    def sympy_intersection(set1: str, set2: str) -> str:
        """Compute intersection of two sets.
    
        Args:
            set1: First set
            set2: Second set
    
        Returns:
            Intersection as string
    
        Example:
            >>> sympy_intersection("{1,2,3}", "{2,3,4}")
            "{2, 3}"
        """
        s1 = _sympify(set1)
        s2 = _sympify(set2)
        return str(Intersection(s1, s2))
  • The @mcp.tool() decorator that registers sympy_intersection as an MCP tool on the FastMCP server instance.
    @mcp.tool()
  • The _sympify helper function used by sympy_intersection to convert string expressions to SymPy objects.
    def _sympify(expr: str) -> sympy.Basic:
        """Convert string expression to SymPy object."""
        return sympy.sympify(expr)
Behavior1/5

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

No annotations are present, so the description must fully disclose behavior. However, it only states the operation without mentioning side effects, purity, or any constraints, falling short of the burden.

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, direct sentence with no wasted words. It is immediately readable and front-loaded.

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

Completeness4/5

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

For a simple mathematical set operation, the description is largely sufficient, especially given the presence of an output schema. It could briefly mention the expected string format (e.g., SymPy set notation) for extra clarity, but not essential.

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 already fully describes the two string parameters with basic descriptions. The tool description adds no additional meaning beyond the schema, and with 100% schema coverage, the baseline of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the action ('Compute intersection') and the resource ('two sets'), matching the tool name. It distinguishes intersection from sibling set operations like union or complement implicitly, though not explicitly.

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?

The description provides no guidance on when to use this tool versus alternatives (e.g., union, complement), no prerequisites, and no examples of when not to use it.

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