Skip to main content
Glama
youngsu-Kim

macaulay2-mcp

by youngsu-Kim

m2_evaluate

Execute Macaulay2 code in a persistent session and retrieve its output, with state preserved across calls for multi-step computations such as Groebner bases and Hilbert polynomials.

Instructions

Evaluate Macaulay2 code in the persistent session and return its output.

    State (rings, variables, ideals, ...) persists across calls. M2 errors
    are included in the returned text and do not break the session.
    Separate statements with newlines: a trailing ";" suppresses that
    statement's result (use an explicit "print" to force output).

    Args:
        code: Macaulay2 code, e.g. "R = QQ[x,y,z]

I = ideal(x^3 - y, x^4 - z) print generators (gb I)" timeout_s: Author-set safety limit (default 120, max 3600). Raise it for heavy computations (large Groebner bases, Hilbert polynomials, ...). On timeout the session is restarted, so the retried code must include all setup again. stop_on_error: Default False = REPL semantics (an error does not stop later lines from running). True sends the code input by input and halts at the first error, leaving later inputs unexecuted. Requires each line to be a self-contained statement (do not break a line after a binary operator).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
timeout_sNo
stop_on_errorNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly. It discloses that state persists, errors appear in output without breaking the session, timeouts restart the session, and stop_on_error changes execution semantics. These are exactly the behavioral traits an agent needs to know and go well beyond basic 'evaluates code'.

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

Conciseness4/5

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

The description is well-organized with a lead summary followed by parameter details, and almost every sentence adds value. It loses a point due to a slightly garbled phrase ('sends the code input by input') and a couple of parenthetical asides that slow reading.

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

Completeness5/5

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

For a tool with session persistence, timeouts, error handling, and three parameters, the description is essentially complete. It covers output as text, error inclusion, state persistence, restart behavior, and parameter semantics. Since an output schema exists, the lack of detailed return-value formatting is acceptable.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate for all three parameters. It explains code with a concrete example, timeout_s with default, max, and consequence (session restart), and stop_on_error with default, REPL semantics, and line-format requirements. This fully covers what the schema lacks.

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 that the tool evaluates Macaulay2 code in a persistent session and returns its output. This is specific about the verb, resource, and session context, but it does not explicitly mention sibling tools to differentiate them. An agent can still infer the distinction from the 'persistent session' phrasing.

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

Usage Guidelines4/5

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

The description provides rich usage context: it explains persistent state, statement separation, trailing semicolons, timeout behavior, and stop_on_error semantics. However, it never explicitly says when to use this tool versus m2_run_script or other siblings, leaving the timing to inference rather than explicit guidance.

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