Skip to main content
Glama
xiaoyuchenhot

MCP Multi-Tool Server

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the core behavior (division), explicitly states the error condition ('Raises: ValueError: If b is zero'), and clarifies the return value. However, it lacks details on edge cases (e.g., floating-point precision, negative numbers) or performance considerations.

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

Conciseness5/5

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

The description is well-structured with clear sections (Args, Returns, Raises) and front-loaded with the core purpose. Every sentence adds value: the first states the operation, and subsequent sections provide necessary details without redundancy. It's appropriately sized for a simple mathematical function.

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

Completeness5/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, no annotations, and the presence of an output schema (which handles return value documentation), the description is complete. It covers the operation, parameters, return value, and error conditions, leaving no significant gaps for this straightforward tool.

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

Parameters5/5

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

The schema description coverage is 0%, so the description must fully compensate. It provides clear semantic explanations for both parameters ('a: The dividend', 'b: The divisor'), which adds essential meaning beyond the schema's generic 'number' types. This fully addresses the parameter documentation gap.

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

Purpose5/5

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

The description clearly states the specific mathematical operation ('divide the first number by the second number'), identifies the resource (numbers), and distinguishes this from sibling tools like 'add', 'multiply', or 'subtract' by specifying division. The purpose is unambiguous and differentiated.

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 'calculate_percentage' or other mathematical operations. It states what the tool does but offers no context about appropriate use cases, prerequisites, or comparisons with sibling tools.

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/xiaoyuchenhot/MCP-example'

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