Skip to main content
Glama

subtract

Calculate the difference between two numbers using a simple subtraction tool. Input the minuend and subtrahend to get the result quickly.

Instructions

Subtract two numbers

Input Schema

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

Implementation Reference

  • Handler function that takes two numbers 'a' and 'b', computes a - b, and returns the result as a text content block.
    async ({ a, b }) => ({ content: [ { type: "text", text: `${a} - ${b} = ${a - b}` } ] })
  • Zod input schema defining the two numeric parameters for subtraction.
    inputSchema: { a: z.number().describe("First number (minuend)"), b: z.number().describe("Second number (subtrahend)") }
  • Registration of the 'subtract' tool with server.registerTool, including schema and handler.
    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}` } ] }) );

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