Skip to main content
Glama

UK Data: Maths and statistics

factorial

Read-onlyIdempotent

Calculates the factorial of a non-negative integer n, which is the product of all positive integers less than or equal to n. Returns n! = n × (n-1) × ... × 1. (cost: 1 credit)

Input Schema

NameRequiredDescriptionDefault
numberNointeger, required, non-negative integer to calculate factorial of

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior3/5

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

The annotations already declare readOnly, idempotent, non-destructive, so the safety profile is covered; the description adds a useful cost signal ('cost: 1 credit') that annotations do not carry. However it omits meaningful behavior for this operation — no stated upper bound on n, no note that very large n produces enormous or unbounded output, and no mention of how a string-typed 'number' parameter is parsed. No contradiction with annotations.

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?

Front-loaded with the verb and resource in the first clause, with the formula and cost trailing. The restatement of the definition as a product and then as a formula is mildly redundant, but overall it is short and every element is on-topic.

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?

For a one-parameter pure computation with no output schema and strong read-only annotations, the description covers what the tool does and what it costs. The remaining gap — practical bounds on n and overflow behavior — is minor given the tool's simplicity, though it would be the one addition that materially improves it.

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% and the single parameter's description already says 'integer, required, non-negative integer to calculate factorial of'. The description restates the same non-negative constraint but adds no format detail (e.g., whether the string accepts leading signs, whitespace, or a max value), so baseline 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 and resource — "Calculates the factorial of a non-negative integer n" — and even restates the result formula, so the operation is unambiguous. It does not differentiate itself from mathematical siblings such as fibonacci, permutation_count, or greatest_common_divisor, but the operation itself is not confusable.

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

Usage Guidelines3/5

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

Usage is only implied: an agent can infer you call this when you need n!. There is no explicit 'use this instead of X' routing (e.g., permutation_count for arrangements), no guidance on input constraints beyond 'non-negative', and no mention of a maximum n where results overflow.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources