Skip to main content
Glama

combinatorics_operation

Idempotent

Compute binomial coefficients, permutations, combinations, integer partitions, factorials, and Catalan, Fibonacci, or Bell numbers for a given integer n.

Instructions

Combinatorics: binomial coefficients, permutations, combinations, integer partitions, factorial, Catalan, Fibonacci and Bell numbers. Prefer this over evaluate_sage for any of these.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kNoSecondary argument (for binomial, combinations). Decimal strings accepted, as for n.
nYesPrimary integer argument. Values at or above 2^53 must be passed as a decimal string, e.g. "9007199254740993", because a JSON number that large has already been rounded by the client.
sessionNoWorkspace to use, as a name or a portable handle. Workspaces have independent variables. A name is scoped to this MCP session; a handle returned by start_sage_session (workspace_token) reaches the same workspace across reconnects and is a bearer credential -- keep it secret. Omit for 'default'.default
operationYesOne of: binomial (n choose k), permutations (n!), combinations (n choose k), partitions (COUNT of integer partitions of n), factorial (n!), catalan (nth Catalan number), fibonacci (nth Fibonacci number), bell (nth Bell number). All return a single integer.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.0
    • changedInput schema / properties / session / description
      Previous value: -"Named workspace to use. Workspaces have independent variables; omit for 'default'."New value: +"Workspace to use, as a name or a portable handle. Workspaces have independent variables. A name is scoped to this MCP session; a handle returned by start_sage_session (workspace_token) reaches the same workspace across reconnects and is a bearer credential -- keep it secret. Omit for 'default'."
  2. Changed7 schema fields changedv0.5.0
    • changedInput schema / properties / k / anyOf
      Previous value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / k / description
      Previous value: -"Secondary argument (for binomial, combinations)"New value: +"Secondary argument (for binomial, combinations). Decimal strings accepted, as for n."
    • addedInput schema / properties / n / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "string"
      +  }
      +]
    • changedInput schema / properties / n / description
      Previous value: -"Primary integer argument"New value: +"Primary integer argument. Values at or above 2^53 must be passed as a decimal string, e.g. \"9007199254740993\", because a JSON number that large has already been rounded by the client."
    • removedInput schema / properties / n / type
      Removed value: -"integer"
    • changedInput schema / properties / operation / description
      Previous value: -"One of: binomial, permutations, combinations, partitions, factorial, catalan, fibonacci, bell"New value: +"One of: binomial (n choose k), permutations (n!), combinations (n choose k), partitions (COUNT of integer partitions of n), factorial (n!), catalan (nth Catalan number), fibonacci (nth Fibonacci number), bell (nth Bell number). All return a single integer."
    • addedInput schema / properties / session
      Added value: +{
      +  "default": "default",
      +  "description": "Named workspace to use. Workspaces have independent variables; omit for 'default'.",
      +  "type": "string"
      +}
  3. First observedv0.3.1

TDQS

A3.6/5.0
Behavior2/5

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

The annotations already declare idempotentHint=true and destructiveHint=false, and the only behavioral statement in the description ('All return a single integer') duplicates what the output schema already conveys. The description never explains the readOnlyHint=false signal or the session/workspace state implications, both of which are non-obvious for a computation tool.

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?

Two sentences, zero filler. The operation list is front-loaded and the routing advice is placed second where it is most actionable.

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?

With an output schema present, return-value explanation is unnecessary, and the description covers scope plus sibling routing adequately. It is only slightly incomplete in not touching on session/workspace state, though that is handled by the schema's session parameter description.

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 description coverage is 100%, so n, k, session, and operation are already fully documented in the schema, including the decimal-string requirement and the workspace_token credential note. The description adds no parameter meaning of its own, which is acceptable at baseline 3 when the schema does the heavy lifting.

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 names the domain (combinatorics) and enumerates the exact operations available (binomial, permutations, combinations, partitions, factorial, Catalan, Fibonacci, Bell), so an agent knows precisely what it computes. It is not a bare tautology, but it lacks an explicit verb like 'compute' and leans on the sibling-tool sentence to establish what it actually does.

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?

It explicitly routes the agent away from evaluate_sage for these operation types, which is a concrete when-to-use rule with a named alternative. It does not state any when-not conditions or prerequisites (e.g., session requirements), so it falls short of the full 5.

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