Skip to main content
Glama
tech-sushant

Calculator MCP Server

by tech-sushant

subtract

Calculate the difference between two numbers by subtracting the second value from the first value. Use this tool to perform subtraction operations and find numerical differences.

Instructions

Subtract second number from first number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesNumber to subtract from
bYesNumber to subtract

Implementation Reference

  • The switch case handler for the 'subtract' tool. It extracts parameters 'a' and 'b', computes 'a - b', and returns a text response with the formatted result.
    case "subtract": {
      const { a, b } = args as { a: number; b: number };
      const result = a - b;
      return {
        content: [
          {
            type: "text",
            text: `${a} - ${b} = ${result}`,
          },
        ],
      };
    }
  • src/index.ts:38-55 (registration)
    The registration of the 'subtract' tool in the list of available tools, including its name, description, and input schema definition.
    {
      name: "subtract",
      description: "Subtract second number from first number",
      inputSchema: {
        type: "object",
        properties: {
          a: {
            type: "number",
            description: "Number to subtract from",
          },
          b: {
            type: "number",
            description: "Number to subtract",
          },
        },
        required: ["a", "b"],
      },
    },
  • The input schema for the 'subtract' tool, defining parameters 'a' (number to subtract from) and 'b' (number to subtract), both required.
    inputSchema: {
      type: "object",
      properties: {
        a: {
          type: "number",
          description: "Number to subtract from",
        },
        b: {
          type: "number",
          description: "Number to subtract",
        },
      },
      required: ["a", "b"],
    },
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 operation but lacks details on error handling (e.g., for non-numeric inputs), performance characteristics, or output format. 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 a single, efficient sentence that directly states the tool's purpose with zero waste. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 high schema coverage, the description is minimally adequate. It covers the basic operation but lacks context on output values, error conditions, or behavioral traits, which could be helpful for an AI agent.

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?

Schema description coverage is 100%, with clear parameter descriptions in the schema (e.g., 'a' as 'Number to subtract from', 'b' as 'Number to subtract'). The description adds no additional meaning beyond what the schema provides, such as examples or edge cases, so it meets the baseline for high schema coverage.

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 'Subtract second number from first number' clearly states the specific mathematical operation (subtract) and identifies the resources (numbers). It distinguishes from sibling tools like 'add', 'divide', 'multiply', 'power', and 'sqrt' by specifying the exact arithmetic operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for subtraction operations but provides no explicit guidance on when to use this tool versus alternatives like 'add' or 'divide'. No context about mathematical scenarios or exclusions is mentioned, leaving usage to inference from the tool name and description.

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

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