Skip to main content
Glama

sympy_complement

Compute the complement of a subset within a universal set, returning elements in set2 not present in set1.

Instructions

Compute complement of set1 in set2.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
set1YesSubset
set2YesUniversal set

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the sympy_complement tool. Takes two string sets, converts them to SymPy objects via _sympify, computes their set complement using SymPy's Complement, and returns the result as a string.
    @mcp.tool()
    def sympy_complement(set1: str, set2: str) -> str:
        """Compute complement of set1 in set2.
    
        Args:
            set1: Subset
            set2: Universal set
    
        Returns:
            Complement as string
    
        Example:
            >>> sympy_complement("{1,2}", "{1,2,3,4}")
            "{3, 4}"
        """
        s1 = _sympify(set1)
        s2 = _sympify(set2)
        return str(Complement(s1, s2))
  • Registration of sympy_complement via the @mcp.tool() decorator on the FastMCP instance 'mcp', which registers it as an MCP tool.
    @mcp.tool()
  • Helper function that converts a string expression to a SymPy object using sympy.sympify. Used by sympy_complement to parse the string set arguments.
    def _sympify(expr: str) -> sympy.Basic:
        """Convert string expression to SymPy object."""
        return sympy.sympify(expr)
  • Import of SymPy's Complement class, which is used in the function to compute the set complement.
    Complement,
  • The FastMCP instance that provides the @mcp.tool() decorator for registering tools.
    mcp = fastmcp.FastMCP("mcp-sympy")
Behavior2/5

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

The description does not disclose any behavioral traits beyond the basic operation. There are no annotations to supplement. Important details like whether it modifies inputs, errors, or returns a set type are missing.

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 extremely concise, consisting of a single sentence that conveys the essential information without any extraneous text. This is ideal for quick scanning.

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?

Given the presence of many set-related sibling tools, the description lacks context such as the types of sets supported or examples of usage. An output schema exists but its content is not shown; the description could still benefit from more details.

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?

Schema coverage is 100% with brief parameter descriptions ('Subset' and 'Universal set'). The tool description adds no additional meaning beyond what the schema already provides, so it meets the baseline.

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 clearly states the operation (complement) and the two sets involved (set1 in set2). This is specific and distinguishes it from other set operations like union or intersection, which are present as sibling tools (sympy_union, sympy_intersection).

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 complement vs. other set operations. The description merely states what it does, without any context for when to choose it over alternatives.

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