# Complex Math Tool

## Links

- Product page URL: https://www.agentpmt.com/marketplace/complex-math-tool
- Product markdown URL: https://www.agentpmt.com/marketplace/complex-math-tool?format=agent-md
- Product JSON URL: https://www.agentpmt.com/marketplace/complex-math-tool?format=agent-json

## Overview

- Product ID: 694ecf2fcca5b5123ad00c32
- Vendor: Apoth3osis
- Type: core utility
- Unit type: request
- Price: 500 credits
- Categories: Scientific Computing, Financial Modeling, Mathematical Computing
- Generated at: 2026-05-30T20:16:06.212Z

### Page Description

A utility for common mathematical calculations frequently needed in business, finance, data analysis, and everyday applications. It provides comprehensive percentage operations including calculating what percent one value is of another, finding a percentage of a given number, and determining percent increase or decrease between two values for tracking growth or decline metrics. Ratio calculation simplifies proportions between multiple numbers by finding the greatest common divisor and reducing to the smallest whole number representation. Number rounding supports configurable decimal precision from 0 to 10 places for formatting financial figures, measurements, and display values. Random number generation produces both floating-point values with specified decimal precision and integers within defined minimum and maximum bounds for sampling, testing, and simulation purposes. Aggregate functions operate on arrays of numbers to calculate sums, arithmetic averages, and identify minimum and maximum values with their array positions. The greatest common divisor function finds the largest integer that evenly divides all numbers in a set, useful for simplifying fractions and ratio calculations. All operations return formatted strings alongside raw values for immediate display or further computation.

### Agent Description

Math calculations: percentages, ratios, rounding, random numbers, aggregates (sum, avg, min, max), GCD. Returns formatted and raw values.

## Details

### Details

A utility for common mathematical calculations frequently needed in business, finance, data analysis, and everyday applications. It provides comprehensive percentage operations including calculating what percent one value is of another, finding a percentage of a given number, and determining percent increase or decrease between two values for tracking growth or decline metrics. Ratio calculation simplifies proportions between multiple numbers by finding the greatest common divisor and reducing to the smallest whole number representation. Number rounding supports configurable decimal precision from 0 to 10 places for formatting financial figures, measurements, and display values. Random number generation produces both floating-point values with specified decimal precision and integers within defined minimum and maximum bounds for sampling, testing, and simulation purposes. Aggregate functions operate on arrays of numbers to calculate sums, arithmetic averages, and identify minimum and maximum values with their array positions. The greatest common divisor function finds the largest integer that evenly divides all numbers in a set, useful for simplifying fractions and ratio calculations. All operations return formatted strings alongside raw values for immediate display or further computation.

### Actions

- `math-percent-calculate` (5 credits): Calculate what percentage one value is of a total. Provide two numbers: [value, total]. Returns the percentage with formatted output.
- `math-percentage-of` (5 credits): Calculate X% of a given value. For example, calculate 15% of 200. Returns the computed result.
- `math-percent-increase` (5 credits): Calculate the percent increase from an original value to a new value. Provide two numbers: [original, new].
- `math-percent-decrease` (5 credits): Calculate the percent decrease from an original value to a new value. Provide two numbers: [original, new].
- `math-ratio-calculate` (5 credits): Calculate and simplify the ratio between two or more numbers. Returns the simplified ratio.
- `math-round-number` (5 credits): Round a number to a specified number of decimal places.
- `math-random-number` (5 credits): Generate a random floating-point number within a specified range, rounded to a given number of decimal places.
- `math-random-integer` (5 credits): Generate a random integer within a specified range (inclusive on both ends).
- `math-sum` (5 credits): Calculate the sum of an array of numbers.
- `math-average` (5 credits): Calculate the arithmetic mean (average) of an array of numbers.
- `math-min` (5 credits): Find the minimum (smallest) value in an array of numbers.
- `math-max` (5 credits): Find the maximum (largest) value in an array of numbers.
- `math-gcd` (5 credits): Calculate the greatest common divisor (GCD) of an array of integers.

### Use Cases

Percentage calculation, percent of total, what percent is X of Y, percentage of value, calculate X percent of Y, percent increase calculation, growth rate calculation, percent decrease calculation, decline rate calculation, year over year change, price change percentage, ratio calculation, ratio simplification, proportion calculation, aspect ratio, recipe ratio scaling, number rounding, decimal place formatting, financial rounding, currency formatting, precision control, random number generation, random float generation, random decimal, random integer generation, random int range, dice roll simulation, lottery number generator, random sampling, sum calculation, total calculation, add numbers, array sum, average calculation, mean calculation, arithmetic mean, data average, minimum value finder, min function, lowest value, array minimum, maximum value finder, max function, highest value, array maximum, GCD calculation, greatest common divisor, fraction simplification, common factor, business math, financial calculations, data analysis math, statistical operations, AI agent math, LLM calculations, automation math operations, workflow calculations, quick math API

### Workflows Using This Tool

No public workflows currently reference this product.

### Related Content

No related content is currently linked to this product.

## Integration Details

### DynamicMCP

- Setup page URL: https://www.agentpmt.com/dynamic-mcp
- Claude setup guide: https://www.agentpmt.com/dynamic-mcp?platform=claude#videos
- ChatGPT setup guide: https://www.agentpmt.com/dynamic-mcp?platform=chatgpt#videos
- Cursor setup guide: https://www.agentpmt.com/dynamic-mcp?platform=cursor#videos
- Windsurf setup guide: https://www.agentpmt.com/dynamic-mcp?platform=windsurf#videos

Use the local router for command-based MCP clients. It forwards requests to `https://api.agentpmt.com/mcp` and does not execute tools locally.

```bash
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

### REST API

The live page renders cURL, Python, JavaScript, and Node.js examples. Logged-in users see those examples prefilled with their own API and budget credentials.

- Purchase endpoint: https://api.agentpmt.com/products/purchase
- Authorization format: `Bearer <base64(apiKey:budgetKey)>`

```bash
curl -X POST "https://api.agentpmt.com/products/purchase" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eW91ci1hcGkta2V5LWhlcmU6eW91ci1idWRnZXQta2V5LWhlcmU=" \
  -d '{
    "product_id": "694ecf2fcca5b5123ad00c32",
    "parameters": {
      "action": "math-percent-calculate",
      "numbers": []
    }
  }'
```

### Autonomous Agents

Autonomous agents can access this tool through AgentAddress credit balances or direct x402 payments. Use the Autonomous Agent API reference for endpoint shapes after choosing the access pattern below.

- Autonomous Agent API reference URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents
- Autonomous Agent API reference markdown URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents?format=agent-md
- Credit-Based Access Using AgentAddress: https://www.agentpmt.com/docs/autonomous-agents/credit-based-tool-usage-with-agentaddress
- AgentAddress is preferred for persistent file access, stored platform state, and maximum tool use ability across repeated calls.
- Direct x402 is for independent one-off tool calls that do not require shared files or stored platform state.
- Direct x402 public payments: USDC on Base, Arbitrum, Optimism, Polygon, and Avalanche.

### Schema

#### Parameters

- Schema type: actions

```json
{
  "actions": {
    "math-percent-calculate": {
      "description": "Calculate what percentage one value is of a total. Provide two numbers: [value, total]. Returns the percentage with formatted output.",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of exactly 2 numbers: [value, total]. Example: [25, 200] calculates what percent 25 is of 200.",
          "required": true
        }
      }
    },
    "math-percentage-of": {
      "description": "Calculate X% of a given value. For example, calculate 15% of 200. Returns the computed result.",
      "properties": {
        "percent": {
          "type": "number",
          "description": "The percentage to apply (e.g., 25 for 25%).",
          "required": true
        },
        "value": {
          "type": "number",
          "description": "The value to calculate the percentage of.",
          "required": true
        }
      }
    },
    "math-percent-increase": {
      "description": "Calculate the percent increase from an original value to a new value. Provide two numbers: [original, new].",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of exactly 2 numbers: [original, new]. Example: [100, 150] calculates percent increase from 100 to 150.",
          "required": true
        }
      }
    },
    "math-percent-decrease": {
      "description": "Calculate the percent decrease from an original value to a new value. Provide two numbers: [original, new].",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of exactly 2 numbers: [original, new]. Example: [200, 150] calculates percent decrease from 200 to 150.",
          "required": true
        }
      }
    },
    "math-ratio-calculate": {
      "description": "Calculate and simplify the ratio between two or more numbers. Returns the simplified ratio.",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of 2 or more numbers to calculate the ratio for. Example: [10, 25, 50].",
          "required": true
        }
      }
    },
    "math-round-number": {
      "description": "Round a number to a specified number of decimal places.",
      "properties": {
        "value": {
          "type": "number",
          "description": "The number to round.",
          "required": true
        },
        "decimals": {
          "type": "integer",
          "description": "Number of decimal places (0-10). Default: 2.",
          "required": false,
          "default": 2,
          "minimum": 0,
          "maximum": 10
        }
      }
    },
    "math-random-number": {
      "description": "Generate a random floating-point number within a specified range, rounded to a given number of decimal places.",
      "properties": {
        "min_value": {
          "type": "number",
          "description": "Minimum value for the random number (inclusive).",
          "required": true
        },
        "max_value": {
          "type": "number",
          "description": "Maximum value for the random number (exclusive). Must be greater than min_value.",
          "required": true
        },
        "decimals": {
          "type": "integer",
          "description": "Number of decimal places for the result (0-10). Default: 2.",
          "required": false,
          "default": 2,
          "minimum": 0,
          "maximum": 10
        }
      }
    },
    "math-random-integer": {
      "description": "Generate a random integer within a specified range (inclusive on both ends).",
      "properties": {
        "min_value": {
          "type": "number",
          "description": "Minimum integer value (inclusive).",
          "required": true
        },
        "max_value": {
          "type": "number",
          "description": "Maximum integer value (inclusive). Must be greater than min_value.",
          "required": true
        }
      }
    },
    "math-sum": {
      "description": "Calculate the sum of an array of numbers.",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of 1 or more numbers to sum. Example: [10, 20, 30].",
          "required": true
        }
      }
    },
    "math-average": {
      "description": "Calculate the arithmetic mean (average) of an array of numbers.",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of 1 or more numbers to average. Example: [10, 20, 30].",
          "required": true
        }
      }
    },
    "math-min": {
      "description": "Find the minimum (smallest) value in an array of numbers.",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of 1 or more numbers. Returns the smallest value and its index.",
          "required": true
        }
      }
    },
    "math-max": {
      "description": "Find the maximum (largest) value in an array of numbers.",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of 1 or more numbers. Returns the largest value and its index.",
          "required": true
        }
      }
    },
    "math-gcd": {
      "description": "Calculate the greatest common divisor (GCD) of an array of integers.",
      "properties": {
        "numbers": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Array of 1 or more integers. Values are converted to integers before calculation.",
          "required": true
        }
      }
    }
  },
  "properties": {
    "action": {
      "type": "string",
      "description": "The mathematical operation to perform. Use 'get_instructions' to retrieve documentation. Available actions: Percentage operations (math-percent-calculate, math-percentage-of, math-percent-increase, math-percent-decrease), Number operations (math-ratio-calculate, math-round-number, math-sum, math-average, math-min, math-max, math-gcd), Random generation (math-random-number, math-random-integer)",
      "required": true,
      "enum": [
        "get_instructions",
        "math-percent-calculate",
        "math-percentage-of",
        "math-percent-increase",
        "math-percent-decrease",
        "math-ratio-calculate",
        "math-round-number",
        "math-random-number",
        "math-random-integer",
        "math-sum",
        "math-average",
        "math-min",
        "math-max",
        "math-gcd"
      ]
    },
    "numbers": {
      "type": "array",
      "description": "Array of numbers for multi-value operations. Used for: math-percent-calculate ([value, total]), math-percent-increase ([original, new]), math-percent-decrease ([original, new]), math-ratio-calculate (2+ numbers), math-sum (1+ numbers), math-average (1+ numbers), math-min (1+ numbers), math-max (1+ numbers), math-gcd (1+ integers)",
      "required": false,
      "items": {
        "type": "number"
      }
    },
    "value": {
      "type": "number",
      "description": "Single numeric value. Used for: math-percentage-of (the value to calculate percentage of), math-round-number (the number to round)",
      "required": false
    },
    "percent": {
      "type": "number",
      "description": "Percentage value (e.g., 25 for 25%). Used for: math-percentage-of (calculate X% of value)",
      "required": false
    },
    "decimals": {
      "type": "integer",
      "description": "Number of decimal places (0-10). Used for: math-round-number, math-random-number. Default: 2",
      "required": false,
      "default": 2,
      "minimum": 0,
      "maximum": 10
    },
    "min_value": {
      "type": "number",
      "description": "Minimum value for random generation. Used for: math-random-number, math-random-integer",
      "required": false
    },
    "max_value": {
      "type": "number",
      "description": "Maximum value for random generation. Used for: math-random-number, math-random-integer",
      "required": false
    }
  }
}
```

### Usage Instructions

# Complex Math Tool - Instructions

## Overview
The Complex Math Tool provides a comprehensive set of mathematical operations including percentage calculations, number rounding, random number generation, aggregate operations (sum, average, min, max), ratio simplification, and greatest common divisor computation.

## Actions

### math-percent-calculate
Calculate what percentage one value is of a total.

**Required fields:**
- `numbers` (array): Exactly 2 numbers — [value, total]

**Example:**
```json
{
  "action": "math-percent-calculate",
  "numbers": [25, 200]
}
```
Returns: "25 is 12.5% of 200"

---

### math-percentage-of
Calculate X% of a given value.

**Required fields:**
- `percent` (number): The percentage to apply (e.g., 25 for 25%)
- `value` (number): The base value

**Example:**
```json
{
  "action": "math-percentage-of",
  "percent": 15,
  "value": 200
}
```
Returns: "15% of 200 = 30"

---

### math-percent-increase
Calculate the percent increase from an original value to a new value.

**Required fields:**
- `numbers` (array): Exactly 2 numbers — [original, new]

**Example:**
```json
{
  "action": "math-percent-increase",
  "numbers": [100, 150]
}
```
Returns: "100 to 150 is a 50% increase"

---

### math-percent-decrease
Calculate the percent decrease from an original value to a new value.

**Required fields:**
- `numbers` (array): Exactly 2 numbers — [original, new]

**Example:**
```json
{
  "action": "math-percent-decrease",
  "numbers": [200, 150]
}
```
Returns: "200 to 150 is a 25% decrease"

---

### math-ratio-calculate
Simplify the ratio between two or more numbers.

**Required fields:**
- `numbers` (array): 2 or more numbers

**Example:**
```json
{
  "action": "math-ratio-calculate",
  "numbers": [10, 25, 50]
}
```
Returns: Simplified ratio "2:5:10"

---

### math-round-number
Round a number to a specified number of decimal places.

**Required fields:**
- `value` (number): The number to round

**Optional fields:**
- `decimals` (integer, 0-10): Decimal places. Default: 2

**Example:**
```json
{
  "action": "math-round-number",
  "value": 3.14159,
  "decimals": 3
}
```
Returns: 3.142

---

### math-random-number
Generate a random floating-point number within a range.

**Required fields:**
- `min_value` (number): Minimum value (inclusive)
- `max_value` (number): Maximum value (must be greater than min_value)

**Optional fields:**
- `decimals` (integer, 0-10): Decimal places for the result. Default: 2

**Example:**
```json
{
  "action": "math-random-number",
  "min_value": 1.0,
  "max_value": 100.0,
  "decimals": 4
}
```
Returns: A random float between 1.0 and 100.0 with 4 decimal places

---

### math-random-integer
Generate a random integer within a range (inclusive on both ends).

**Required fields:**
- `min_value` (number): Minimum integer value (inclusive)
- `max_value` (number): Maximum integer value (inclusive, must be greater than min_value)

**Example:**
```json
{
  "action": "math-random-integer",
  "min_value": 1,
  "max_value": 100
}
```
Returns: A random integer between 1 and 100

---

### math-sum
Calculate the sum of an array of numbers.

**Required fields:**
- `numbers` (array): 1 or more numbers

**Example:**
```json
{
  "action": "math-sum",
  "numbers": [10, 20, 30, 40, 50]
}
```
Returns: 150

---

### math-average
Calculate the arithmetic mean of an array of numbers.

**Required fields:**
- `numbers` (array): 1 or more numbers

**Example:**
```json
{
  "action": "math-average",
  "numbers": [85, 90, 78, 92, 88]
}
```
Returns: 86.6

---

### math-min
Find the minimum (smallest) value in an array of numbers.

**Required fields:**
- `numbers` (array): 1 or more numbers

**Example:**
```json
{
  "action": "math-min",
  "numbers": [45, 12, 67, 3, 89]
}
```
Returns: 3 (at index 3)

---

### math-max
Find the maximum (largest) value in an array of numbers.

**Required fields:**
- `numbers` (array): 1 or more numbers

**Example:**
```json
{
  "action": "math-max",
  "numbers": [45, 12, 67, 3, 89]
}
```
Returns: 89 (at index 4)

---

### math-gcd
Calculate the greatest common divisor (GCD) of an array of integers.

**Required fields:**
- `numbers` (array): 1 or more integers (decimal values are converted to integers)

**Example:**
```json
{
  "action": "math-gcd",
  "numbers": [48, 36, 24]
}
```
Returns: GCD is 12

---

## Common Workflows

### Price discount calculation
1. Use `math-percentage-of` to calculate the discount amount (e.g., 20% of $150)
2. Use `math-sum` with a negative discount to get the final price

### Comparing performance metrics
1. Use `math-percent-increase` or `math-percent-decrease` to compare two periods
2. Use `math-average` to find the mean across multiple data points

### Statistical summary of a dataset
1. Use `math-sum` for the total
2. Use `math-average` for the mean
3. Use `math-min` and `math-max` for the range

### Random selection
1. Use `math-random-integer` for picking random IDs or indices
2. Use `math-random-number` for generating random decimal values (e.g., test data)

## Important Notes
- Division by zero is handled gracefully with descriptive error messages (e.g., percent-calculate with total=0)
- The `numbers` array order matters for percentage and ratio operations — check each action's description for the expected order
- GCD values are converted to integers before calculation
- Random number generation requires min_value to be strictly less than max_value
- All results include a human-readable `formatted` or `calculation` string for easy display

### Frequently Asked Questions

#### How do I connect this tool to an external agent?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

You can install the local MCP server by opening a terminal and running:

```
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

This will connect you to local agents like Claude Code, Windsurf, Grok Build, Cursor, etc.

Alternatively you can connect to the hosted version with this config block, no installation required:

```
{
  "mcpServers": {
    "agentpmt": {
      "type": "streamable-http",
      "url": "https://api.agentpmt.com/mcp",
      "headers": {
        "Authorization": "Bearer <AGENTPMT_BEARER_TOKEN>",
        "x-instance-metadata": "{\"client\":\"generic-mcp\",\"platform\":\"remote\"}"
      }
    }
  }
}
```

[View MCP Connection Instructions](/docs/mcp-reference/connection) for more details.

#### How does an external agent use this tool?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

After the external agent is connected to an Agent Group that can use this tool, paste this prompt into the agent:

> Call the AgentPMT-Tool-Search-and-Execution tool with action 'get\_schema' and tool\_id 694ecf2fcca5b5123ad00c32 ("Complex Math Tool"). Then call the same tool with action 'call\_tool', tool\_id 694ecf2fcca5b5123ad00c32, and the parameters needed for my request.

The agent should fetch the tool schema first, collect the required parameters for your request, and then call the tool through AgentPMT.

### Dependencies

This product has no public dependency products.