Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

div

Divide one number by another to return the quotient.

Instructions

Divide two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler function for the 'div' tool. It divides two numbers (a/b) and returns the result as text content.
    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 division of ${a} and ${b} is ${result}` }] };
    },
  • The full tool definition including the schema (name: 'div', description, inputSchema with a: number, b: number) and the handler.
    export const div: Tool = {
      schema: {
        name: "div",
        description: "Divide two numbers",
        inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })),
      },
      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 division of ${a} and ${b} is ${result}` }] };
      },
    };
  • src/server.ts:7-9 (registration)
    The 'div' tool is imported from ./tools and added to the tools array, which is then registered with the MCP server via ListToolsRequestSchema and CallToolRequestSchema handlers.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
  • src/tools/index.ts:2-2 (registration)
    Re-exports the div tool from ./div, making it available via the barrel index.
    export * from "./div";
  • The Tool interface type that the div export conforms to, defining the schema and handle structure.
    export interface Tool {
      schema: ToolSchema;
      handle: (params: Record<string, unknown>) => Promise<ToolResult>;
    }
Behavior1/5

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

No annotations are present, so the description carries the full burden of behavioral disclosure. It fails to specify how errors like division by zero are handled, or if integer vs. floating-point arithmetic is used.

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?

The description is very short, but this is appropriate for a simple tool. However, it lacks critical information that would earn its place, such as error handling or parameter order.

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 simplicity (2 parameters, no output schema, no annotations), the description is incomplete as it omits key behavioral details like division-by-zero behavior and return type.

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

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no descriptions for parameters (0% coverage), and the description adds no meaning beyond the schema, merely stating 'divide two numbers' without explaining the roles of 'a' and 'b'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Divide two numbers' clearly specifies the verb (divide) and the resource (two numbers), and the tool name 'div' together with sibling names (add, mod, etc.) makes the distinction obvious.

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 is provided on when to use this tool versus alternatives, such as when to prefer division over other arithmetic operations, or if there are prerequisites like avoiding division by zero.

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