Skip to main content
Glama
DouglasGBailey

Calculator MCP Server

Calculator MCP Server

A very basic MCP (Model Context Protocol) server built for training purposes. It exposes five simple tools over stdio so you can see the core MCP mechanics — tool listing, input schemas, and structured responses — without any extra complexity like auth, persistence, or external APIs.

Tools

Tool

Input

Description

add

{a: number, b: number}

Returns a + b

subtract

{a: number, b: number}

Returns a - b

multiply

{a: number, b: number}

Returns a * b

divide

{a: number, b: number}

Returns a / b (errors on b = 0)

reverse_string

{text: string}

Returns the reversed string

Related MCP server: mcp-poc

Setup

npm install
npm run build

Testing locally

Use the MCP Inspector to interactively call each tool from a browser UI:

npm run inspect

This opens a local web page where you can select a tool, fill in arguments, and see the raw JSON-RPC request/response.

Using it in Claude Desktop / Claude Code

Add this to your MCP client's config (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "calculator": {
      "command": "node",
      "args": ["/Users/douglasbailey/my-dev/claude-mcp/dist/index.js"]
    }
  }
}

Restart the client, and the five calculator tools will be available for Claude to call.

How it works

  • src/index.ts creates an MCP Server, declares the tools capability, and connects over StdioServerTransport (the standard transport for local MCP servers).

  • ListToolsRequestSchema handler returns the tool definitions (name, description, JSON-schema input).

  • CallToolRequestSchema handler dispatches on request.params.name and returns {content: [{type: "text", text: ...}]}.

  • Throwing an Error inside a handler (e.g. divide-by-zero) is automatically surfaced to the client as a tool error — no special handling needed.

Available Tools

5 tools
addA

Add two numbers together

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

A4/5.0
Behavior3/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 accurately states the core operation but does not explicitly mention the return value (the sum) or any error conditions. For a pure arithmetic operation this is a minor gap, but a strictly higher score would require more explicit behavioral disclosure.

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, tightly worded sentence that wastes no words and front-loads the operation. It is concise and well-structured for a simple tool.

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

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-number arithmetic tool, the description is largely complete: it specifies the operation and the schema defines required inputs. There is no output schema or annotations, but the expected result (the sum) is universally implied. A slightly higher score would require explicit mention of return type or edge cases, which are low-risk here.

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?

Input schema covers both parameters fully (100% coverage) with descriptions for 'a' and 'b'. The tool description adds no parameter-level semantic detail beyond indicating the operation is addition, which is expected. Baseline 3 is appropriate when schema already documents parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Add two numbers together' uses a specific verb (add) and resource (two numbers), clearly distinguishing it from sibling arithmetic tools like subtract, multiply, and divide. An agent can immediately understand what this tool does and how it differs from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies the context of use: whenever addition of two numbers is needed. Though it doesn't explicitly enumerate when not to use it versus alternatives, the semantic clarity of 'add' combined with the sibling names makes the choice unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

divideB

Divide a by b

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the entire behavioral burden, yet it discloses nothing about division-by-zero handling, return format, or error behavior. For a trivial arithmetic tool that is forgivable, but the disclosure is still effectively absent.

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?

A single short sentence with no padding, front-loading the operation and its operands. Nothing could be trimmed without losing content.

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?

For a two-parameter pure arithmetic tool with a fully-covered schema and no output schema, the definition is nearly adequate. The remaining gap — no statement of what happens when b is zero — is minor but real for a divide operation.

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%, so the schema already names both parameters; the baseline is 3. The description does add one useful nuance beyond the schema — that 'a' is the numerator and 'b' the denominator — but that is the only extra meaning conveyed.

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 pairs a clear verb with its operands ('Divide a by b'), which is enough to separate it from the arithmetic siblings add, subtract, and multiply. It does not, however, distinguish operand ordering semantics or distinguish itself from anything but the obvious siblings, so it does not reach the top mark.

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?

There is no guidance on when to use this tool versus alternatives; the description assumes the agent already knows it needs division. No prerequisites, no context, no exclusions are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

multiplyB

Multiply two numbers together

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the behavioral burden. It clearly indicates a pure arithmetic operation, but it does not mention return behavior, edge cases, or any potential side effects. For a simple multiplication tool, this is adequate but not rich.

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?

A single, tightly written sentence with no redundant explanation. It is appropriately sized for the simplicity of the operation and is immediately understandable.

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

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of a two-number multiplication, the description plus schema is sufficient for an agent to invoke the tool. There is no output schema, but the result is naturally inferable from the operation described.

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%, so the schema already documents both parameters clearly. The description adds no additional meaning beyond what the parameter names and descriptions provide.

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 states the operation ('multiply') and the target ('two numbers'), which is clear and specific. It doesn't explicitly differentiate from siblings like add, subtract, and divide, but the operation itself is unambiguous enough for selection.

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?

There is no guidance about when to use this tool versus the sibling tools. The description simply states what it does, leaving the agent to infer that it should be used when multiplication is needed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

reverse_stringB

Reverse a string of text

ParametersJSON Schema
NameRequiredDescriptionDefault
textYesThe text to reverse

TDQS

B3.4/5.0
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 behavioral burden, and it discloses nothing beyond the tautological restatement of the name. It does not mention edge cases such as empty strings, Unicode/grapheme handling, or surrogate pairs, which are the only meaningful behavioral questions for a string reversal.

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?

A single six-word sentence that front-loads the verb and resource with zero padding. Nothing could be removed without losing meaning.

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

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter, non-nested tool with no output schema, the definition is nearly sufficient: the return value (the reversed string) is strongly implied. A brief note on return shape or Unicode handling would close the remaining gap.

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% and the single parameter ('text') is already documented in the schema as 'The text to reverse'. The description adds no format, encoding, or constraint details beyond what the schema provides, so the baseline of 3 applies.

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 states a specific verb and resource ('Reverse a string of text'), making the operation immediately clear. It does not explicitly differentiate itself from siblings, but the siblings (add, subtract, multiply, divide) are unrelated arithmetic tools, so no differentiation is needed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit when-to-use or when-not-to-use guidance. However, for a trivial pure-string operation whose purpose is unambiguous, the usage is strongly implied by the name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

subtractB

Subtract b from a

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

B3.1/5.0
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 says nothing about purity, side effects, error behavior (e.g., non-numeric input), or return value. A pure arithmetic function has little to disclose, but the definition still adds nothing here.

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?

A single short sentence, fully front-loaded, with zero filler. Nothing could be removed without losing the operand-order information.

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

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter pure arithmetic primitive with complete schema descriptions and no output schema, the definition is nearly sufficient. Only the operand-order benefit saves it from being tautological; return-value expectations are self-evident for a subtraction primitive.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description earns above baseline because it pins down operand order for a non-commutative operation: 'Subtract b from a' means a - b, resolving genuine ambiguity that the schema labels ('First number'/'Second number') do not.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the operation and, importantly, the operand order ('b from a'), which distinguishes it from a naive reading of the name. However, it is still essentially a restatement of the tool name and offers no differentiation from siblings add/multiply/divide beyond the obvious verb change.

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 on when to use this versus the sibling arithmetic tools. For a trivial math primitive this is arguably self-evident, but the description offers no context, no constraints, and no alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv1.0.0
    • First observedadd
    • First observeddivide
    • First observedmultiply
    • First observedreverse_string
    • First observedsubtract

TDQS

A3.7/5.0

Scored across 5 tools

Disambiguation4/5

The four arithmetic tools (add, subtract, multiply, divide) have clearly distinct, unambiguous purposes. The only oddity is reverse_string, which is unrelated to arithmetic and slightly muddies the server's scope, though it does not overlap with any other tool.

Naming Consistency5/5

All tools use lowercase snake_case with a consistent verb-based pattern (add, subtract, multiply, divide, reverse_string). No mixing of conventions or casing styles.

Tool Count5/5

Five tools is well-scoped for a simple calculator. Each operation earns its place and there is no redundancy or bloat.

Completeness4/5

Core arithmetic is fully covered (add, subtract, multiply, divide), but common calculator operations like modulo, exponent, or square root are missing. reverse_string also feels out of place and suggests an incomplete or inconsistent domain focus.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    D
    quality
    D
    maintenance
    Provides basic mathematical operations (addition, subtraction, multiplication, division) through a calculate tool. Supports both stdio and HTTP/SSE transport modes.
    1
    9
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A minimal MCP server with four tools (add, greet, text_stats, divide) demonstrating typed parameters, structured outputs, and error handling over stdio transport.
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Provides basic calculator operations (add, subtract, multiply, divide) as MCP tools for use with Claude Desktop and other MCP clients.
    -
  • F
    license
    A
    quality
    C
    maintenance
    A learning-oriented MCP server that exposes basic tools (echo, add, reverse) over stdio transport to validate MCP handshake and tool calls.
    3
    -