Skip to main content
Glama

divide

Perform division calculations by dividing one number by another. This tool handles basic arithmetic division operations and prevents division by zero errors.

Instructions

Divide the first number by the second number. Args: a: The dividend (number to be divided) b: The divisor (number to divide by) Returns: The quotient of a divided by b (a / b) Raises: ValueError: If b is zero (division by zero)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • server.py:71-88 (handler)
    The 'divide' tool handler function, registered via @mcp.tool() decorator. It takes two float arguments, checks for division by zero, and returns the quotient.
    @mcp.tool() def divide(a: float, b: float) -> float: """ Divide the first number by the second number. Args: a: The dividend (number to be divided) b: The divisor (number to divide by) Returns: The quotient of a divided by b (a / b) Raises: ValueError: If b is zero (division by zero) """ if b == 0: raise ValueError("Division by zero is not allowed") 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