Skip to main content
Glama
bahfahh

Basic Math MCP Server

subtraction

Calculate the difference between two numbers by subtracting the second number from the first. Use this tool for quick and accurate subtraction operations.

Instructions

Subtract the second number from the first number

Input Schema

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

Implementation Reference

  • src/index.ts:44-62 (registration)
    Registers the 'subtraction' MCP tool with description, Zod input schema for numbers a and b, and inline async handler that computes and returns the result as text content.
    server.tool( "subtraction", "Subtract the second number from the first number", { a: z.number().describe("First number (minuend)"), b: z.number().describe("Second number (subtrahend)") }, async ({ a, b }: { a: number; b: number }) => { const result = a - b; return { content: [ { type: "text", text: `The subtraction of ${b} from ${a} is: ${result}` } ] }; } );
  • The handler function implementing the core logic: subtracts b from a and formats the result into an MCP text response.
    async ({ a, b }: { a: number; b: number }) => { const result = a - b; return { content: [ { type: "text", text: `The subtraction of ${b} from ${a} is: ${result}` } ] }; }
  • Zod-based input schema defining parameters 'a' (minuend) and 'b' (subtrahend) as numbers.
    { a: z.number().describe("First number (minuend)"), b: z.number().describe("Second number (subtrahend)") },

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/bahfahh/mcptest'

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