Skip to main content
Glama
bahfahh

Basic Math MCP Server

subtraction

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

Instructions

Subtract the second number from the first number

Input Schema

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

Implementation Reference

  • The handler function performs subtraction (a - b) and returns a formatted 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 schema defining input parameters 'a' (minuend) and 'b' (subtrahend) as numbers.
    { a: z.number().describe("First number (minuend)"), b: z.number().describe("Second number (subtrahend)") },
  • src/index.ts:44-62 (registration)
    Registration of the 'subtraction' tool with server.tool(), including name, description, input schema, and handler function.
    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}` } ] }; } );

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

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