Skip to main content
Glama
kylekanouse

Demo MCP Server

by kylekanouse

Subtraction Tool

subtract

Calculate the difference between two numbers by subtracting the second from the first. Use this tool to perform basic arithmetic subtraction operations.

Instructions

Subtract two numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYesFirst number (minuend)
bYesSecond number (subtrahend)

Implementation Reference

  • Async handler function that performs the subtraction operation (a - b) and formats the result as text content for the MCP response.
    async ({ a, b }) => ({
      content: [
        {
          type: "text",
          text: `${a} - ${b} = ${a - b}`
        }
      ]
    })
  • Zod input schema defining the two numeric parameters: 'a' (minuend) and 'b' (subtrahend).
    inputSchema: {
      a: z.number().describe("First number (minuend)"),
      b: z.number().describe("Second number (subtrahend)")
    }
  • Registration of the 'subtract' tool using McpServer.registerTool, specifying name, metadata (title, description, schema), and handler function.
    server.registerTool(
      "subtract",
      {
        title: "Subtraction Tool", 
        description: "Subtract two numbers",
        inputSchema: {
          a: z.number().describe("First number (minuend)"),
          b: z.number().describe("Second number (subtrahend)")
        }
      },
      async ({ a, b }) => ({
        content: [
          {
            type: "text",
            text: `${a} - ${b} = ${a - b}`
          }
        ]
      })
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Subtract two numbers' implies a mathematical operation but doesn't disclose error handling (e.g., for non-numeric inputs), performance characteristics, or any side effects. It's minimal and lacks context beyond the basic operation.

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 'Subtract two numbers' is extremely concise—three words that directly state the tool's function with zero waste. It's front-loaded and efficiently communicates the core purpose without unnecessary elaboration.

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 states what the tool does but lacks details on usage, behavior, or output, making it incomplete for richer agent understanding.

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 parameters 'a' and 'b' well-documented as 'First number (minuend)' and 'Second number (subtrahend)'. The description doesn't add meaning beyond the schema, but the schema provides sufficient detail, so the baseline score of 3 is appropriate.

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

Purpose3/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 verb (subtract) and resource (numbers), but it's vague about scope and doesn't distinguish from sibling tools like 'add' or 'divide'. It specifies the operation but lacks detail about what makes subtraction unique compared to other arithmetic operations available.

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 like 'add' or 'divide'. The description doesn't mention any context, prerequisites, or exclusions for using subtraction, leaving the agent to infer usage based solely on the tool name.

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/kylekanouse/Test-MCP---DEMO-MCP-Dev-1'

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