Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

sqrt

Calculate the square root of a number. Input a numeric value to get its square root.

Instructions

Square root of a number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes

Implementation Reference

  • The handler function that executes the sqrt tool logic: extracts 'a' from params, computes Math.sqrt(a), and returns a text result.
    handle: async (params) => {
      const a = params.a as number;
      const result = Math.sqrt(a);
      return { content: [{ type: "text", text: `The square root of ${a} is ${result}` }] };
    },
  • Input/output schema for the sqrt tool, defining a single 'a' number parameter.
    export const sqrt: Tool = {
      schema: {
        name: "sqrt",
        description: "Square root of a number",
        inputSchema: zodToJsonSchema(z.object({ a: z.number() })),
  • src/server.ts:7-9 (registration)
    The sqrt tool is imported from './tools' (which re-exports from './sqrt') and added to the tools array in server.ts, making it available via ListToolsRequestSchema and CallToolRequestSchema handlers.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
Behavior2/5

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

The description lacks behavioral details such as handling edge cases (negative numbers, zero, very large numbers) or return value format. With no annotations provided, the description carries the burden of disclosure but fails to mention critical behavior like potential NaN or error.

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 concise and front-loaded with the core purpose. It is a single short phrase without fluff. While efficient, it could include additional context without harming conciseness.

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

Completeness2/5

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

Given no output schema and simple parameter, the description should at least mention the return type (number) or domain restrictions. It only states the operation, omitting important context about input constraints and output behavior.

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?

The schema has 0% description coverage, but the description implies the parameter is the number to take the square root of. However, it adds little beyond the schema's type and requiredness. For a single parameter, the baseline is 3 as it is minimally acceptable.

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 'Square root of a number' clearly states the operation and the resource (a number). It distinguishes from siblings (add, div, etc.) as they are binary operations. However, it could explicitly mention the mathematical domain (non-negative numbers) for completeness.

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?

No usage guidelines are provided. The description does not specify when to use this tool versus alternatives (e.g., for exponentiation or division) or mention any prerequisites (e.g., non-negative input).

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/wrtnlabs/calculator-mcp'

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