Skip to main content
Glama
wrtnlabs

Calculator MCP

by wrtnlabs

sqrt

Calculate the square root of a number using the sqrt tool in Calculator MCP, designed to perform precise mathematical operations for LLMs.

Instructions

Square root of a number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes

Implementation Reference

  • Full implementation of the 'sqrt' tool, including schema definition and the handler function that computes Math.sqrt(a).
    export const sqrt: Tool = {
      schema: {
        name: "sqrt",
        description: "Square root of a number",
        inputSchema: zodToJsonSchema(z.object({ a: z.number() })),
      },
      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 schema for the sqrt tool using Zod for validation (expects object with 'a' number).
    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 and registered in the main tools array used by the MCP server.
    import { add, div, mod, mul, sqrt, sub } from "./tools";
    
    const tools = [add, div, mod, mul, sqrt, sub];
  • src/tools/index.ts:5-5 (registration)
    Re-export of the sqrt tool from the tools index module.
    export * from "./sqrt";
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Square root of a number' implies a mathematical calculation but doesn't specify error handling (e.g., negative inputs), precision, return format, or computational characteristics. For a mathematical tool with zero annotation coverage, this leaves significant behavioral gaps.

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 extremely concise at just four words, front-loading the core purpose immediately. There's zero wasted language or redundancy. Every word earns its place by communicating the essential mathematical operation.

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 a mathematical tool with no annotations, no output schema, and 0% parameter schema coverage, the description is insufficiently complete. It doesn't address return values, error conditions, mathematical domain restrictions, or how results are formatted. For even a simple mathematical function, more context would be helpful for reliable agent operation.

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

Parameters2/5

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

The schema has 0% description coverage for its single parameter 'a', and the description provides no parameter information beyond the generic 'a number'. The description doesn't clarify what type of number (integer, decimal, complex), valid ranges, or special cases (like negative numbers). With low schema coverage, the description fails to compensate adequately.

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 mathematical operation being performed (square root) on a specific resource (a number). It distinguishes from siblings like 'add' or 'mul' by specifying the square root function rather than basic arithmetic. However, it doesn't explicitly mention the tool name 'sqrt' which could provide additional clarity.

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 mathematical purpose is clear, there's no mention of when to choose sqrt over other mathematical operations or whether there are specific use cases or constraints for this tool. The agent must infer usage from the mathematical context alone.

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

Related Tools

  • @kelseyee/mcp_calculator
  • @balajidommeti/MCP
  • @wrtnlabs/calculator-mcp
  • @kelseyee/mcp_calculator
  • @shaleen-wonder-ent/simple-mcp-server
  • @wrtnlabs/calculator-mcp

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