Skip to main content
Glama
codewithmsunke

MCP Math Server

Subtraction tool

subtract

Calculate the difference between two numbers by subtracting the second value from the first value.

Instructions

Subtract b from a (a - b)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • The handler function for the 'subtract' tool. It takes inputs 'a' and 'b', computes their difference (a - b), and returns a structured text response containing the result.
    async ({ a, b }) => {
      const diff = a - b;
      return {
        content: [
          { type: "text", text: `The difference of ${a} and ${b} is ${diff}` }
        ]
      };
    }
  • The input schema for the 'subtract' tool, defining 'a' and 'b' as numbers using Zod validation.
    inputSchema: { a: z.number(), b: z.number() },
  • src/index.ts:59-74 (registration)
    The registration of the 'subtract' tool on the MCP server, including name, metadata, schema, and handler function.
    server.registerTool(
      "subtract",
      {
        title: "Subtraction tool",
        description: "Subtract b from a (a - b)",
        inputSchema: { a: z.number(), b: z.number() },
      },
      async ({ a, b }) => {
        const diff = a - b;
        return {
          content: [
            { type: "text", text: `The difference of ${a} and ${b} is ${diff}` }
          ]
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only states the mathematical operation without mentioning error handling (e.g., what happens with non-numeric inputs), performance characteristics, or any side effects. For a tool with zero annotation coverage, this leaves significant behavioral gaps unaddressed.

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 zero wasted words - just 6 words that directly state the operation. It's perfectly front-loaded with the essential information. Every word earns its place in this minimal but complete operational statement.

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?

For a simple mathematical tool with 2 parameters, no annotations, and no output schema, the description provides the core operation but lacks context about error conditions, return values, or mathematical constraints. It's minimally adequate for basic use but doesn't prepare the agent for edge cases or provide complete operational context.

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

Parameters4/5

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

The description clearly explains the parameter relationship 'Subtract b from a (a - b)', which adds crucial semantic meaning beyond the schema's basic type declarations. With 0% schema description coverage and 2 parameters, this compensates well by clarifying the order and operation of parameters, though it doesn't specify numeric constraints or special cases.

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 states the specific mathematical operation 'Subtract b from a (a - b)', which clearly indicates what the tool does. However, it doesn't distinguish this from sibling tools like 'add' or 'divide' beyond the basic operation name. The description is functional but lacks differentiation from alternatives in the same mathematical toolkit.

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', 'divide', or 'multiply'. There's no mention of appropriate mathematical contexts, error conditions, or comparisons to sibling tools. The user must infer usage solely from the operation name without any contextual help.

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/codewithmsunke/MCPMathTools'

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