Skip to main content
Glama
ArjunKrish7356

Math MCP Server

MathAgent

A minimal math agent that delegates all calculations to an MCP (Model Context Protocol) server. The agent uses MCP tools for every operation—no mental math—so you get consistent, inspectable results.

What’s inside

  • Agent: built with pydantic-ai, connected via MCP stdio

  • MCP Server: powered by fastmcp, exposing math tools

Available MCP tools

  • add

  • subtract

  • multiply

  • divide

  • power

  • log

Coming soon:

  • modulus

Related MCP server: Math MCP Server

Requirements

  • Python 3.13+

  • uv (Python package/dependency manager)

  • A Groq API key (for the LLM model)

  • A Logfire token (for instrumentation)

Setup

  1. Clone the repository

  2. Create your environment file

    • Set these keys:

      • groq_key — your Groq API key

      • logfire_key — your Logfire token

Run the agent

Run with uv so dependencies are resolved and the MCP server is launched as a toolset:

uv run agent.py

Notes:

  • The agent is configured to use the Groq model qwen/qwen3-32b (see agent.py). You can swap models as needed.

  • The agent will reject non-math questions by design.

  • All calculations route through the MCP tools defined in mcp-server.py.

Contributing

Contributions are welcome—feel free to open issues or submit pull requests.

Available Tools

6 tools
addA

Adds two integer numbers together.

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/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 states the tool 'adds two integer numbers together', which implies a read-only computation, but does not disclose any behavioral traits such as error handling, performance characteristics, or constraints. The description is minimal and lacks context beyond the basic operation.

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

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 tool's low complexity (simple arithmetic), 2 parameters, no annotations, and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the core operation but could benefit from additional context, such as handling of non-integer inputs or error cases, to be fully comprehensive.

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?

The description adds meaning by specifying that the parameters are 'two integer numbers', which clarifies the expected input types beyond the schema's generic 'number' type. With 0% schema description coverage and 2 parameters, this compensates well, though it could note that 'a' and 'b' correspond to the two numbers being added.

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 clearly states the specific verb ('adds') and resource ('two integer numbers together'), making the purpose explicit. It distinguishes this tool from its siblings (divide, log, multiply, power, subtract) by specifying the addition operation, which is helpful for an AI agent to select the correct mathematical tool.

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?

The description implies usage for adding integers, but does not explicitly state when to use this tool versus alternatives like 'multiply' or 'subtract'. It provides basic context (adding numbers) but lacks guidance on exclusions or specific scenarios, leaving some ambiguity for the agent in choosing between sibling tools.

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

divideA

Divide two numbers. Raises an error if dividing by zero.

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/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 adds value by specifying the error behavior for division by zero, which is a key behavioral trait. However, it lacks details on other aspects like input validation for non-numeric values, performance characteristics, or return format, leaving some gaps in transparency.

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 with two sentences that are front-loaded and waste no words. The first sentence states the purpose, and the second adds critical behavioral context, making it efficient and well-structured.

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 tool's low complexity (simple arithmetic), 2 parameters, no annotations, but with an output schema (which handles return values), the description is mostly complete. It covers the core operation and a key error case, but could improve by mentioning the output type or handling of non-integer results to fully compensate for the lack of annotations.

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?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that the parameters are 'two numbers' and the semantic role (dividend and divisor implied), which clarifies beyond the schema's generic 'A' and 'B' titles. However, it does not specify the order of parameters (e.g., a divided by b) or handle for edge cases like floating-point division.

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 clearly states the specific action ('Divide two numbers') and the resource (numbers), distinguishing it from sibling tools like add, subtract, multiply, and power by specifying the division operation. It's precise and unambiguous.

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 provides clear context for usage by mentioning the error condition ('Raises an error if dividing by zero'), which implicitly guides when not to use it (i.e., avoid division by zero). However, it does not explicitly compare to alternatives like using 'multiply' with reciprocals or mention specific scenarios for choosing division over other operations.

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

logA

Calculate the logarithm of a number with the specified base (default base 10).

Args: a: The number to calculate logarithm for (must be positive) base: The base of the logarithm (must be positive and not equal to 1, default is 10)

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
baseNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses key behavioral constraints (positive number requirement, base restrictions) and the default base value, which is valuable. However, it doesn't mention error handling, precision, or return format details that would be helpful for a mathematical operation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with a clear purpose statement followed by parameter documentation. The Args section is structured but could be more integrated. Every sentence earns its place, though the formatting could be slightly more front-loaded with the core purpose.

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 mathematical nature, 2 parameters, 0% schema coverage, and existence of an output schema, the description provides good context. It covers purpose, parameter semantics, and constraints. The output schema existence means return values don't need explanation, making this reasonably complete for a mathematical function tool.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing complete semantic information for both parameters: 'a' is 'the number to calculate logarithm for (must be positive)' and 'base' is 'the base of the logarithm (must be positive and not equal to 1, default is 10)'. This adds crucial meaning beyond the bare schema.

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 clearly states the specific mathematical operation ('calculate the logarithm'), identifies the resource ('a number'), and distinguishes it from sibling arithmetic tools (add, subtract, multiply, divide, power) by focusing on logarithmic calculation rather than basic arithmetic or exponentiation.

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?

The description implies usage context through the mathematical function name and parameter constraints, but doesn't explicitly state when to use this tool versus alternatives like 'power' for exponentiation or other mathematical operations. No explicit guidance on when-not-to-use or named alternatives is provided.

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
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/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 states what the tool does ('multiply two numbers') but doesn't describe any behavioral traits such as error handling, performance characteristics, or side effects. For a mathematical operation, this might be acceptable, but it lacks depth for more complex scenarios.

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, clear sentence with zero waste. It is front-loaded with the core purpose and appropriately sized for a simple mathematical tool. Every word earns its place, making it highly efficient and easy to parse.

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 tool's simplicity (basic arithmetic), two parameters, and the presence of an output schema, the description is complete enough for an agent to understand and invoke the tool. It covers the purpose and parameter count, and the output schema likely handles return values. However, it lacks usage guidelines and behavioral details, which are minor gaps for this context.

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?

The description implies two parameters ('two numbers'), which aligns with the input schema's two required parameters (a and b). Since schema description coverage is 0%, the description adds meaningful context by specifying the operation and parameter count, though it doesn't detail parameter types or constraints beyond what the schema provides. With 0 parameters documented in the schema, the description adequately compensates.

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 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 mention sibling differentiation. The description is specific but lacks explicit comparison to alternatives.

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 like 'add', 'divide', or 'power'. It doesn't mention any context, prerequisites, or exclusions for usage. The agent must infer usage from the tool name alone, which is insufficient for optimal selection.

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

powerA

Raise a number to the power of another number (a^b).

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only states the mathematical operation but doesn't mention important behavioral aspects like handling of negative bases, fractional exponents, overflow/underflow, precision limitations, or error conditions. This leaves significant gaps in understanding how the tool behaves beyond the basic operation.

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 perfectly concise - a single sentence that directly states the tool's purpose with zero wasted words. It's front-loaded with the core functionality and uses efficient mathematical notation (a^b) to convey the operation compactly.

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 mathematical nature and presence of an output schema, the description covers the basic operation adequately. However, for a mathematical function with potential edge cases (negative bases, large exponents, etc.) and no annotations, it should ideally mention some behavioral constraints. The output schema likely handles return values, but the description could better address operational boundaries.

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?

The description adds meaningful semantics by explaining that parameter 'a' is the base and 'b' is the exponent (a^b), which goes beyond the schema's generic 'A' and 'B' titles. With 0% schema description coverage and 2 parameters, this provides essential context about what each parameter represents in the mathematical operation.

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 clearly states the specific mathematical operation ('Raise a number to the power of another number') and distinguishes it from sibling tools like add, subtract, multiply, and divide by specifying exponentiation. It uses precise terminology (a^b) that unambiguously defines the tool's function.

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 like log (which might be used for inverse operations) or other mathematical functions. It simply states what the tool does without any context about appropriate use cases or comparisons to sibling tools.

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

subtractC

subtract two integer numbers together.

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/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 mentions the operation but doesn't describe traits like error handling (e.g., for non-integer inputs), performance characteristics, or side effects. For a mathematical tool with zero annotation coverage, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is appropriately sized but not optimally structured. It's front-loaded with the core action but includes the awkward phrase 'together', which doesn't add value. While concise, it could be more precise (e.g., 'Subtracts one integer from another').

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 tool's low complexity (basic arithmetic), two parameters, no annotations, and an output schema (which likely handles return values), the description is mostly complete. It covers the core operation but lacks usage guidelines and behavioral details. The presence of an output schema reduces the need to explain returns, making this adequate but not comprehensive.

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?

The description adds minimal meaning beyond the input schema, which has 0% description coverage. It clarifies that parameters 'a' and 'b' are 'two integer numbers', providing basic type context not in the schema (which lists them as 'number'). However, it doesn't explain parameter roles (e.g., minuend and subtrahend) or constraints. With 0 parameters documented in the schema, the baseline is 4, as the description compensates slightly.

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 tool's purpose as 'subtract two integer numbers together', which is clear but vague. It specifies the verb (subtract) and resource (two integer numbers), but doesn't differentiate from sibling tools like 'add' or 'divide' beyond the operation name. The phrase 'together' is slightly awkward for subtraction but doesn't obscure the basic intent.

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 'add', 'divide', 'multiply', or 'power'. The description simply states what it does without indicating appropriate contexts, prerequisites, or comparisons to sibling tools. This leaves the agent without explicit usage direction.

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. Dates show when Glama detected each change.

  1. 6 tool updatesv0.1.0
    • Removedadd
    • Removeddivide
    • Removedlog
    • Removedmultiply
    • Removedpower
    • Removedsubtract
  2. 6 tool updates
    • First observedadd
    • First observeddivide
    • First observedlog
    • First observedmultiply
    • First observedpower
    • First observedsubtract

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a clearly distinct mathematical operation: addition, division, logarithm, multiplication, exponentiation, and subtraction. There is no overlap in purpose, making it easy for an agent to select the correct tool based on the desired calculation.

Naming Consistency5/5

All tool names follow a consistent verb-only pattern (e.g., add, divide, log, multiply, power, subtract) without mixing conventions. This simplicity and uniformity make the naming highly predictable and readable.

Tool Count5/5

With 6 tools, this server is well-scoped for a math utility, covering core arithmetic and basic mathematical functions. Each tool earns its place without feeling excessive or insufficient for the domain.

Completeness4/5

The tool set covers essential operations like addition, subtraction, multiplication, division, exponentiation, and logarithms, providing a solid foundation. However, minor gaps exist, such as missing trigonometric functions (e.g., sine, cosine) or advanced operations like square roots, which agents might need to work around for broader mathematical tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables basic arithmetic operations (addition, subtraction, multiplication, division) with 64-bit precision and matrix multiplication capabilities. Provides mathematical computation tools for AI assistants through the Model Context Protocol.
    5
    1
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to perform accurate mathematical calculations by evaluating expressions using mathjs. Supports basic arithmetic, functions, constants, and complex mathematical operations through natural language requests.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides mathematical operation tools including basic arithmetic (add, subtract, multiply, divide), power and square root calculations, and safe evaluation of mathematical expressions.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides comprehensive mathematical capabilities including basic arithmetic, advanced functions, statistical tools, and access to mathematical constants. It allows users to perform computations and generate math-related prompts through a standardized MCP interface.
    MIT

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/ArjunKrish7356/MathAgent'

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