Skip to main content
Glama
SanLangLOVE

Simple Calculator MCP

by SanLangLOVE

divide

Calculate the quotient of two numbers by dividing the dividend by the divisor to obtain the result.

Instructions

计算两个数字的商

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes被除数
bYes除数

Implementation Reference

  • The switch case handler for the 'divide' tool. It extracts arguments a and b, checks if b is zero and returns an error if so, otherwise computes and returns the division result.
    case "divide": {
      const { a, b } = args as { a: number; b: number };
      if (b === 0) {
        return {
          content: [
            {
              type: "text",
              text: "错误:除数不能为零",
            },
          ],
          isError: true,
        };
      }
      const result = a / b;
      return {
        content: [
          {
            type: "text",
            text: `${a} ÷ ${b} = ${result}`,
          },
        ],
      };
    }
  • The tool definition in the tools list, including name, description, and input schema for parameters a (dividend) and b (divisor).
    {
      name: "divide",
      description: "计算两个数字的商",
      inputSchema: {
        type: "object",
        properties: {
          a: {
            type: "number",
            description: "被除数",
          },
          b: {
            type: "number",
            description: "除数",
          },
        },
        required: ["a", "b"],
      },
    },
  • src/index.ts:111-115 (registration)
    Registers the handler for ListToolsRequestSchema, which returns the list of tools including 'divide'.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools,
      };
    });
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. It states the action but doesn't disclose behavioral traits like error handling (e.g., division by zero), performance, or output format. This is a significant gap for a tool with no annotations.

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 in Chinese that directly states the tool's purpose without any waste. It is appropriately sized and front-loaded, making it easy to understand quickly.

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

Completeness3/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 (simple arithmetic), 100% schema coverage, and no output schema, the description is minimally adequate. However, it lacks details on behavioral aspects like error handling, which would improve completeness for a tool with no annotations.

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?

Schema description coverage is 100%, with clear descriptions for parameters 'a' (被除数 - dividend) and 'b' (除数 - divisor). The description adds no additional meaning beyond the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

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 '计算两个数字的商' (calculates the quotient of two numbers) clearly states the verb (calculate) and resource (quotient of two numbers). It distinguishes from sibling tools like add, multiply, and subtract by specifying division, though it doesn't explicitly contrast them.

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 like multiply or power. The description implies usage for division but lacks explicit context, prerequisites, or exclusions, such as handling division by zero.

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

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