Skip to main content
Glama

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}` }], }; } );

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