Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

sub

Subtracts the second number from the first to compute the difference between two values.

Instructions

Subtract two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler function for the 'sub' tool: subtracts two numbers (a - b) and returns a text response with the difference.
    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}` }] };
    },
  • The schema definition for the 'sub' tool, defining name='sub', description='Subtract two numbers', and an inputSchema requiring two numbers (a and b).
    export const sub: Tool = {
      schema: {
        name: "sub",
        description: "Subtract two numbers",
        inputSchema: zodToJsonSchema(z.object({ a: z.number(), b: z.number() })),
      },
  • src/server.ts:7-9 (registration)
    The tool is imported from './tools' and placed in the tools array (line 9) which is used to register it with the MCP server.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
  • Re-exports the 'sub' module from './sub' via the barrel index file.
    export * from "./sub";
Behavior2/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. It only states 'subtract', lacking details on safety, return type, error conditions, or side effects.

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

Conciseness4/5

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

The description is very concise (one short sentence) and front-loaded. However, it could be slightly more descriptive without losing conciseness.

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 no output schema or annotations, the description omits return behavior, edge cases, and error handling. It is insufficient for an agent to fully understand usage.

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?

The description adds no meaning beyond the input schema. With 0% schema coverage, it fails to clarify which parameter is subtracted from which, leaving ambiguity.

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 conveys the operation, but it does not specify the order of subtraction (which is the minuend and subtrahend). It distinguishes from sibling tools like add, mul, etc.

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 usage guidelines are provided. The description does not mention when to use this tool, when not to, or any alternatives among siblings.

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