Skip to main content
Glama

square_root

Calculate the square root of any positive number to find the value that, when multiplied by itself, equals the original number.

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

NameRequiredDescriptionDefault
numberYes

Input Schema (JSON Schema)

{ "properties": { "number": { "title": "Number", "type": "number" } }, "required": [ "number" ], "type": "object" }

Implementation Reference

  • The handler function for the 'square_root' tool, decorated with @mcp.tool() for automatic registration. It computes the square root using math.sqrt, with input validation for negative numbers.
    @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)

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