Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

sub

Perform subtraction of two numbers using the Calculator MCP server. Input two numerical values to retrieve the result of the subtraction operation.

Instructions

Subtract two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • Full tool definition including schema and handler function for the 'sub' tool. The handler subtracts two numbers and returns a text response.
    export const sub: Tool = {
      schema: {
        name: "sub",
        description: "Subtract 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 difference of ${a} and ${b} is ${result}` }] };
      },
    };
  • Schema definition for the 'sub' tool, including name, description, and Zod-based input schema for two numbers.
    schema: {
      name: "sub",
      description: "Subtract two numbers",
      inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })),
    },
  • src/server.ts:7-9 (registration)
    Import of the 'sub' tool and registration in the tools array used by the MCP server for listing and calling tools.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
  • src/tools/index.ts:6-6 (registration)
    Re-export of the 'sub' tool from index.ts, facilitating barrel import in server.ts.
    export * from "./sub";
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('subtract') but does not cover aspects like error handling (e.g., for non-numeric inputs), performance, or side effects. This is a significant gap for a tool with no annotation coverage.

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 extremely concise with a single sentence, 'Subtract two numbers', which is front-loaded and wastes no words. It efficiently conveys the core action without unnecessary details, earning a high score for brevity and clarity.

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

Completeness3/5

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

Given the tool's low complexity (simple arithmetic), no annotations, no output schema, and minimal parameters, the description is adequate but has clear gaps. It covers the basic purpose but lacks usage guidelines, behavioral details, and full parameter semantics, making it minimally viable but incomplete for optimal agent use.

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?

The schema description coverage is 0%, so the description must compensate. It implies parameters 'a' and 'b' as the two numbers to subtract, adding basic meaning beyond the schema's type definitions. However, it does not specify order (e.g., a - b) or constraints, leaving some ambiguity, which is partially compensated but not fully.

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 'Subtract two numbers' clearly states the tool's purpose with a specific verb ('subtract') and resource ('two numbers'), making it easy to understand. However, it does not explicitly differentiate from sibling tools like 'add' or 'mul', which are similar arithmetic operations, so it lacks sibling differentiation.

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 like 'add' or 'div'. It implies usage for subtraction but does not specify contexts, exclusions, or prerequisites, leaving the agent to infer based on the tool name alone.

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

Related 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