Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

mod

Compute the remainder of dividing two numbers.

Instructions

Mod two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler function that executes the 'mod' tool logic. It extracts parameters a and b, computes a % b, and returns the result text.
    handle: async (params) => {
      const a = params.a as number;
      const b = params.b as number;
      const result = a % b;
      return { content: [{ type: "text", text: `The modulo of ${a} and ${b} is ${result}` }] };
    },
  • The schema definition for the 'mod' tool, specifying name 'mod', description, and inputSchema with two number parameters (a and b) using Zod and zod-to-json-schema.
    schema: {
      name: "mod",
      description: "Mod two numbers",
      inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })),
    },
  • src/server.ts:7-9 (registration)
    Import and registration of the 'mod' tool in the server's tools array, making it available for dispatch via CallToolRequestSchema handler.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
  • src/tools/index.ts:3-3 (registration)
    Re-exports the 'mod' module from src/tools/mod.ts so it can be imported by the server.
    export * from "./mod";
  • The Tool interface type that defines the shape (schema + handle) which the mod tool conforms to.
    export interface Tool {
      schema: ToolSchema;
      handle: (params: Record<string, unknown>) => Promise<ToolResult>;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It fails to disclose behavioral traits such as handling of zero divisor or return type.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise (three words), but at the cost of necessary details. It is front-loaded but insufficiently informative.

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

Completeness1/5

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

Given the lack of annotations and output schema, the description is too sparse. It does not cover edge cases or result details, making it incomplete for safe 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%. The description 'Mod two numbers' does not clarify parameter order (a mod b vs b mod a), leading to potential confusion.

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 'Mod two numbers' clearly indicates the modulus operation. It distinguishes from sibling tools like add, sub, mul, div, and sqrt. However, it lacks specificity on which number is the dividend and which is the divisor.

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 mod versus alternatives like div or sqrt. The description does not differentiate usage context.

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/wrtnlabs/calculator-mcp'

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