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}` }
          ]
        };
      }
    );

Tool Definition Quality

Score is being calculated. Check back soon.

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