Skip to main content
Glama
codewithmsunke

MCP Math Server

Square tool

square

Calculate the square of any number to determine its value multiplied by itself, useful for mathematical computations and problem-solving.

Instructions

Calculate the square of a number

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes

Implementation Reference

  • The handler function for the 'square' tool that computes the square of the input number 'a' and returns a text response with the result.
    async ({ a }) => {
      const result = a * a;
      return {
        content: [
          { type: "text", text: `The square of ${a} is ${result}` }
        ]
      };
    }
  • Input schema for the 'square' tool, defining the parameter 'a' as a number using Zod validation.
    inputSchema: { a: z.number() },
  • src/index.ts:77-92 (registration)
    Registration of the 'square' tool on the MCP server, including schema and handler function.
    server.registerTool(
      "square",
      {
        title: "Square tool",
        description: "Calculate the square of a number",
        inputSchema: { a: z.number() },
      },
      async ({ a }) => {
        const result = a * a;
        return {
          content: [
            { type: "text", text: `The square of ${a} is ${result}` }
          ]
        };
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool calculates a square, which implies a read-only, non-destructive operation, but doesn't cover potential errors (e.g., for non-numeric inputs), performance aspects, or output format. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

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 and front-loaded, consisting of a single, clear sentence that directly states the tool's function without any wasted words. Every part of the sentence earns its place by conveying essential information efficiently.

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 the tool's low complexity, no annotations, no output schema, and minimal parameter documentation, the description is incomplete. It explains what the tool does but lacks details on usage context, parameter meaning, behavioral traits, or output, making it insufficient for an agent to fully understand how to invoke it correctly.

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 input schema has 0% description coverage, with one parameter 'a' of type 'number' but no explanation in the schema. The description doesn't add any meaning beyond the tool's purpose; it doesn't clarify what 'a' represents (e.g., the input number) or any constraints (e.g., valid ranges). This fails to compensate for the low schema coverage.

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 clearly states the tool's purpose with a specific verb ('calculate') and resource ('square of a number'), making it easy to understand what it does. However, it doesn't explicitly distinguish this from sibling tools like 'multiply' or 'sqrt', which could perform similar mathematical operations, so it doesn't reach the highest score.

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. With siblings like 'multiply' (which could compute squares by multiplying a number by itself) and 'sqrt' (which computes square roots), there's no indication of when 'square' is preferred, leaving the agent to guess based on context.

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/codewithmsunke/MCPMathTools'

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