Skip to main content
Glama

lucas_theorem

Compute binomial coefficients C(n,k) modulo a prime with Lucas' theorem, enabling C(n,k) mod p calculations for large n and k.

Instructions

Compute binomial coefficient C(n,k) mod prime using Lucas' theorem.

Input Schema

NameRequiredDescriptionDefault
kYesNon-negative integer k (k <= n)
nYesNon-negative integer n
pYesPrime modulus

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

B3.3/5.0
Behavior3/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. It does disclose the algorithmic basis (Lucas' theorem), which implies the prime-modulus constraint, but it says nothing about determinism, error behavior for non-prime p or k>n, or the returned form.

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?

A single tight sentence with the resource and method front-loaded and zero filler.

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

Completeness3/5

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

There is no output schema and no annotations, so the description is the only place to explain what is returned (an integer mod p) and edge-case handling, and it omits both. It is minimally adequate for a simple pure-computation tool but leaves real gaps.

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% and all three parameters (n, k, p) are documented in the schema, including constraints like k <= n and p being prime. The description adds no syntax or format detail beyond what the schema already supplies, so the baseline of 3 applies.

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?

States a specific verb (Compute) and resource (binomial coefficient C(n,k) mod prime) and names the method (Lucas' theorem). It is reasonably distinct from plain-combination siblings like combination_calc, though it never explicitly contrasts itself with them.

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 on when to use this versus combination_calc, binomial_probability, or modular_arithmetic. The agent must infer that this is the right tool only when a prime modulus is involved; no prerequisites or exclusions are stated.

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

Deploy Server

Other Tools