Skip to main content
Glama
yogendhra9

Zerodha Trading Bot

by yogendhra9

factorial

Calculate the factorial of a number for mathematical operations within the Zerodha Trading Bot's automated trading system.

Instructions

This tool calculates the factorial of a number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes

Implementation Reference

  • index.js:40-46 (handler)
    The handler function computes the factorial of input 'a' using a simple loop multiplication.
    async ({ a }) => {
      let ans = 1;
      for (let i = 2; i <= a; i++) ans *= i;
      return {
        content: [{ type: "text", text: `${ans}` }],
      };
    }
  • Zod schema defining the input parameter 'a' as a number.
    { a: z.number() },
  • index.js:36-47 (registration)
    Registers the 'factorial' tool using McpServer.tool() with name, description, schema, and handler.
    server.tool(
      "factorial",
      "This tool calculates the factorial of a number",
      { a: z.number() },
      async ({ a }) => {
        let ans = 1;
        for (let i = 2; i <= a; i++) ans *= i;
        return {
          content: [{ type: "text", text: `${ans}` }],
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but reveals nothing about computational limits, error handling (e.g., for negative numbers or non-integers), performance characteristics, or output format. This leaves significant behavioral gaps for an agent.

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?

The description is a single, efficient sentence that directly states the tool's function with zero wasted words. It's appropriately sized for a simple mathematical operation and front-loaded with essential information.

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

Completeness2/5

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

Given the tool's mathematical simplicity and lack of annotations/output schema, the description is incomplete. It doesn't address potential constraints (e.g., integer inputs, recursion limits), error conditions, or return value format, leaving the agent with insufficient context for reliable invocation.

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

Parameters2/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 undocumented parameters. It mentions 'a number' which aligns with the single parameter 'a' of type number, but adds no semantic context about valid ranges (e.g., non-negative integers), units, or examples. This provides minimal value beyond the bare schema.

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 the tool's function with a specific verb ('calculates') and resource ('factorial of a number'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools, which is unnecessary since factorial is mathematically distinct from operations like addition or stock trading tools.

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?

The description provides no guidance on when to use this tool versus alternatives. While the mathematical nature makes usage obvious in some contexts, there's no explicit mention of use cases, prerequisites, or comparisons with sibling tools like addition for different mathematical operations.

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/yogendhra9/ZerodhaMCP'

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