Skip to main content
Glama
codewithmsunke

MCP Math Server

Multiplication tool

multiply

Calculate the product of two numbers using this mathematical operation tool from the MCP Math Server for arithmetic computations.

Instructions

Multiply two numbers a * b

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Implementation Reference

  • Handler function that multiplies two numbers 'a' and 'b', computes the product, and returns a text response with the result.
    async ({ a, b }) => {
      const product = a * b;
      return {
        content: [
          { type: "text", text: `The product of ${a} and ${b} is ${product}` }
        ]
      };
    }
  • Input schema definition using Zod for parameters 'a' and 'b' as numbers, along with title and description.
    {
      title: "Multiplication tool",
      description: "Multiply two numbers a * b",
      inputSchema: { a: z.number(), b: z.number() },
    },
  • src/index.ts:95-110 (registration)
    Registration of the 'multiply' tool with the MCP server, including schema and inline handler.
    server.registerTool(
      "multiply",
      {
        title: "Multiplication tool",
        description: "Multiply two numbers a * b",
        inputSchema: { a: z.number(), b: z.number() },
      },
      async ({ a, b }) => {
        const product = a * b;
        return {
          content: [
            { type: "text", text: `The product of ${a} and ${b} is ${product}` }
          ]
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the basic operation without mentioning traits like error handling (e.g., for non-numeric inputs), performance, or side effects. This leaves significant gaps for an AI agent to understand how the tool behaves beyond the core 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 a single, efficient sentence with zero waste. It's front-loaded with the core purpose and uses clear, direct language, making it easy to parse quickly.

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 simplicity (basic arithmetic) and lack of annotations or output schema, the description is incomplete. It doesn't cover return values, error cases, or behavioral nuances, which are minimal but still relevant for reliable tool invocation by an AI agent.

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 description coverage is 0%, but the description adds minimal semantics by naming the parameters 'a' and 'b' as 'two numbers'. However, it doesn't explain their roles (e.g., multiplicands), constraints, or examples. This provides some value over the bare schema but doesn't fully compensate for the low 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 'Multiply two numbers a * b' clearly states the verb (multiply) and resource (two numbers), making the purpose immediately understandable. It distinguishes from siblings like 'add' or 'subtract' by specifying multiplication, though it doesn't explicitly contrast with all siblings (e.g., 'square' is also a multiplication operation).

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 guidance is provided on when to use this tool versus alternatives. The description doesn't mention use cases, prerequisites, or comparisons to siblings like 'square' (which multiplies a number by itself) or 'gcm/lcm' (which involve multiplication in different contexts).

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