https://github.com/shipfastlabs/toolkit-calculator
[READ ONLY] Subtree split of the Calculator tool - see github.com/shipfastlabs/toolkit
https://github.com/shipfastlabs/toolkit-calculator
ai laravel laravel-ai tool
Last synced: 6 days ago
JSON representation
[READ ONLY] Subtree split of the Calculator tool - see github.com/shipfastlabs/toolkit
- Host: GitHub
- URL: https://github.com/shipfastlabs/toolkit-calculator
- Owner: shipfastlabs
- Created: 2026-05-31T18:24:43.000Z (29 days ago)
- Default Branch: main
- Last Pushed: 2026-06-07T16:20:34.000Z (22 days ago)
- Last Synced: 2026-06-07T18:13:24.278Z (22 days ago)
- Topics: ai, laravel, laravel-ai, tool
- Language: PHP
- Homepage: https://github.com/shipfastlabs/toolkit
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# shipfastlabs/toolkit-calculator
[](https://packagist.org/packages/shipfastlabs/toolkit-calculator)
[](https://packagist.org/packages/shipfastlabs/toolkit-calculator)
> Calculator tool for the Laravel AI SDK
Part of the [shipfastlabs/toolkit](https://github.com/shipfastlabs/toolkit) catalog of reusable AI tools for the Laravel AI SDK.
## Installation
```bash
composer require shipfastlabs/toolkit-calculator
```
## Usage
Instantiate the tool and pass it to an agent's `tools()`:
```php
use Shipfastlabs\Toolkit\Calculator\CalculatorTool;
$tools = [new CalculatorTool];
```
## Input schema
| Parameter | Type | Required | Description |
|---|---|---|---|
| `expression` | string | yes | The mathematical expression to evaluate, e.g. `"3 * (4 + 1)"`. |
Supports `+`, `-`, `*`, `/`, `%`, `^` (exponent, right-associative), parentheses, unary `+`/`-` and decimal numbers.
## Configuration
None. The calculator is pure and ships no config or service provider.
## Safety
The expression is parsed by a small recursive-descent evaluator; PHP's `eval()` is never used. Invalid input, division or modulo by zero, and non-finite results are returned to the model as plain strings rather than thrown, so the model can recover.