Skip to main content
Glama

combinatorics_operation

Compute binomial coefficients, permutations, combinations, integer partitions, factorial, Catalan, Fibonacci, and Bell numbers. Returns a single integer per operation.

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.
sessionNoNamed workspace to use. Workspaces have independent variables; 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

Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only lists operations and a preference note, without mentioning return behavior, side effects, performance, or error conditions. The schema's statement that 'All return a single integer' is behavioral information, but that resides in the schema, not the description, so credit is limited.

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 with no filler. The first sentence front-loads the domain ('Combinatorics:') and the second earns its place by giving usage guidance. Structure is clean and efficient.

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?

There is an output schema, so return values don't need to be in the description. The description covers the tool's purpose and a usage alternative, which is sufficient for a computational tool. It doesn't mention session behavior, but the schema covers the session parameter, so the description is complete enough given the rich schema.

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%, so the baseline is 3. The description does not add any parameter semantics beyond the schema; it repeats operation values already enumerated in the operation property. No extra meaning is provided, so the baseline score is appropriate.

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 enumerates the specific mathematical operations (binomial, permutations, combinations, partitions, factorial, Catalan, Fibonacci, Bell numbers), giving a definite resource scope. It also distinguishes this tool from the sibling evaluate_sage by naming it explicitly, which helps with tool selection.

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

Usage Guidelines5/5

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

The final sentence, 'Prefer this over evaluate_sage for any of these,' directly tells the agent when to use this tool instead of a specific sibling. This is explicit comparative guidance, even if it doesn't mention exclusions or other 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/XBP-Europe/sagemath-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server