Skip to main content
Glama
avanishd-3

Math MCP Server

by avanishd-3

subtract

Calculate the difference between two numbers with 64-bit floating point precision. Supports integers, decimals, and fractions to perform subtraction operations.

Instructions

Subtracts two numbers with 64 bit floating point precision and returns a 64 bit float. For example, subtracting 5 from 10 would return 5.0. You can also use fractions if you want to, like 1/2 for number_1 and 1/3 for number_2.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
number_1Yes
number_2Yes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'subtract' tool. It is registered using the @math_mcp.tool decorator on the FastMCP server instance. The function signature provides the input schema (two numbers: int | float), docstring describes usage and output (float), and the body computes the subtraction with 64-bit precision using NumPy, including logging.
    @math_mcp.tool
    def subtract(
        number_1: int | float,
        number_2: int | float,
    ) -> float:
        """Subtracts two numbers with 64 bit floating point precision and returns a 64 bit float.
           For example, subtracting 5 from 10 would return 5.0.
           You can also use fractions if you want to, like 1/2 for number_1 and 1/3 for number_2.
        """
        result = np.round(np.float64(number_1) - np.float64(number_2), decimals=SIXTY_FOUR_BIT_FLOAT_DECIMAL_PLACES)
        logging.info(f"Doing subtraction: {number_1} - {number_2} -> Result: {result}")
        return result
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the precision (64-bit floating point) and return type, which is helpful. However, it doesn't mention error handling (e.g., for invalid inputs), performance characteristics, or side effects. The example adds some clarity but doesn't fully cover behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three sentences. The first sentence states the core purpose, the second provides an example, and the third adds fraction support. There's minimal redundancy, and information is front-loaded, though the fraction note could be integrated more smoothly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (basic arithmetic), two parameters with 0% schema coverage, and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the operation, precision, and input types via examples, though it lacks explicit parameter definitions and usage guidelines.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It implies that parameters are numbers (via the example and fraction mention) but doesn't explicitly define 'number_1' and 'number_2' or their roles (e.g., minuend and subtrahend). The fraction example adds some meaning but doesn't fully document the two parameters beyond what's inferred from the tool name.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Subtracts two numbers with 64 bit floating point precision and returns a 64 bit float.' This specifies the verb (subtracts), resource (two numbers), and precision details. It distinguishes from siblings like 'add' and 'divide' by focusing on subtraction, though it doesn't explicitly contrast with them.

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' or 'multiply'. It includes an example and mentions fractions, but these are usage examples rather than contextual guidelines for tool selection. There's no mention of prerequisites or exclusions.

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/avanishd-3/math-mcp'

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