Skip to main content
Glama
xiaoyuchenhot

MCP Multi-Tool Server

square_root

Calculate the square root of a number using this mathematical tool. Input a number to get its square root value, with error handling for negative inputs.

Instructions

Calculate the square root of a number.

Args:
    number: The number to find the square root of

Returns:
    The square root of the number

Raises:
    ValueError: If number is negative

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numberYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'square_root' tool. It calculates the square root of a given number using math.sqrt, with error handling for negative inputs. The @mcp.tool() decorator registers it as an MCP tool, and the docstring provides the schema via Args/Returns/Raises.
    @mcp.tool()
    def square_root(number: float) -> float:
        """
        Calculate the square root of a number.
        
        Args:
            number: The number to find the square root of
        
        Returns:
            The square root of the number
        
        Raises:
            ValueError: If number is negative
        """
        if number < 0:
            raise ValueError("Cannot calculate square root of negative number")
        return math.sqrt(number)
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 and does well by specifying the error condition ('Raises: ValueError: If number is negative'). This discloses important behavioral traits beyond the basic operation. However, it doesn't mention precision, handling of zero, or performance characteristics.

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 perfectly structured and front-loaded with the core purpose, followed by organized sections for Args, Returns, and Raises. Every sentence earns its place, with no redundant information. The four-line format is highly efficient for this simple mathematical operation.

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 simplicity (single parameter, mathematical operation) and the presence of an output schema, the description is complete enough. It covers the purpose, parameter meaning, return value, and error conditions - everything needed for a basic square root calculation tool. The output schema handles return value details, so the description doesn't need to elaborate further.

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

Parameters4/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 compensate. It clearly explains the single parameter ('number: The number to find the square root of'), adding meaningful context about what the parameter represents. The description fully documents the only parameter, though it doesn't specify number type constraints beyond the negative value error.

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 explicitly states 'Calculate the square root of a number' - a specific verb ('calculate') with a clear resource ('square root of a number'). It distinguishes from sibling tools like 'power', 'factorial', or 'multiply' by focusing specifically on square root calculation.

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. While the purpose is clear, there's no mention of when square root calculation is appropriate versus using 'power' with exponent 0.5, or how this relates to other mathematical operations in the sibling set.

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