Skip to main content
Glama

subtract

Calculate the difference between two numbers by subtracting the second number from the first number. Get accurate subtraction results for mathematical operations and calculations.

Instructions

Subtract the second number from the first number. Args: a: The first number (minuend) b: The second number (subtrahend) Returns: The difference of a and b (a - b)

Input Schema

NameRequiredDescriptionDefault
aYes
bYes

Input Schema (JSON Schema)

{ "properties": { "a": { "title": "A", "type": "number" }, "b": { "title": "B", "type": "number" } }, "required": [ "a", "b" ], "type": "object" }

Implementation Reference

  • server.py:41-53 (handler)
    The main handler function for the 'subtract' tool. It is registered via the @mcp.tool() decorator. The function takes two float arguments, subtracts b from a, and returns the result. The docstring provides the tool description and parameter details used for schema generation.
    @mcp.tool() def subtract(a: float, b: float) -> float: """ Subtract the second number from the first number. Args: a: The first number (minuend) b: The second number (subtrahend) Returns: The difference of a and b (a - b) """ return 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/xiaoyuchenhot/MCP-example'

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