Foreword¶
In the DSH plugin ecosystem, tool plugins can be independently installed to a specified profile. This section introduces the dsh-tool-calculator maintained by omdsh-dev.
This plugin registers the calculator tool for safely evaluating mathematical expressions. The plugin description characterizes it as “zero dependencies, zero processes, pure functions”; verified information indicates it is compatible with DSH 0.1.2-alpha.1 and can be installed as an independent bundle to a profile. The license is MIT.
Plugin Positioning¶
First, confirm the following basic information:
- npm package name:
@deepseek-ai/dsh-tool-calculator - Registered tool name:
calculator - Repository URL:
https://github.com/omdsh-dev/dsh-tool-calculator - License: MIT
package.jsonhasprivateset totruepackage.jsondeclares Node engine as^22.19.0 || >=24.0.0
The tool input is an expression string, and the output is a finite number; NaN / Infinity are rejected.
Core Functionality¶
Supported Operators¶
The following operations are supported:
+-*/%**- Parentheses
() - Unary plus/minus, e.g.,
+5,-5
Where ** denotes exponentiation and is right-associative:
2 ** 3 ** 2 = 512
Supported Functions and Constants¶
The following functions are supported:
absceilfloorroundsqrtloglog2log10expsincostanpowmaxmin
The following constants are supported:
PIE
Trigonometric functions use radians. If degrees are preferred, conversion must be performed within the expression, for example:
sin(30 * PI / 180)
Safety Boundaries¶
Verified information indicates that this plugin does not use eval or new Function. It uses a hand-written recursive descent parser that only accepts whitelisted numeric literals, identifiers, and operators.
The following patterns will be rejected or cause an error:
- Quotes
- Semicolons
- Backticks
{ }[ ]- Non-whitelisted identifiers
- Expressions evaluating to
NaNorInfinity
In other words, it treats input strictly as mathematical expressions, not as executable code.
Installation and Enabling¶
Installation to a Profile¶
The installation commands are as follows. web and headless are different profiles; choose according to your needs.
For interactive or web profile:
dsh plugin --profile web add github:omdsh-dev/dsh-tool-calculator
For headless profile:
dsh plugin --profile headless add github:omdsh-dev/dsh-tool-calculator
Note: Installing to web does not automatically overwrite headless; dsh run uses the headless profile by default. If you primarily use dsh run, you should install to the headless profile.
Verifying Installation¶
After installation, first check if the plugin appears in the configuration:
dsh --profile web --dump-config | grep tool-calculator
If installed to the headless profile, the corresponding command is:
dsh --profile headless --dump-config | grep tool-calculator
Runtime Verification¶
Use a natural language command to have the agent invoke the calculator tool:
dsh run "使用 calculator 工具计算 1+2*3"
Environment and Dependency Notes¶
The following points are worth confirming before installation:
- Compatible with DSH 0.1.2-alpha.1
- Startup command:
npx -p @deepseek-ai/dsh@next dsh web
- Do not use
install -gfor global installation - Peer dependencies
@deepseek-ai/cordis,@deepseek-ai/dsh-tools,@deepseek-ai/dsh-invariantsare provided via the profile’s healedprofiles/node_modulesfallback installation - DSH 0.1.2-alpha.1 patches use id-targeted semantics and must be wrapped in a
- insert:list
Typical Usage¶
After installation, agents can use the calculator tool to handle mathematical expressions.
Example:
calculator { expression: "15 + 27 * sqrt(9)" } → 96
Run via command line:
dsh run "使用 calculator 工具计算 1+2*3"
Exponentiation:
2 ** 3 ** 2 = 512
Trigonometric functions with degree conversion:
sin(30 * PI / 180)
Use Cases and Considerations¶
This plugin is suitable for scenarios where agents need deterministic mathematical evaluation capabilities. It limits computation to the expression layer, avoiding passing input to code execution environments.
Before use, it is recommended to confirm:
- The plugin runs with the current dsh process permissions
- Source code and license should be checked before installation
- License is MIT
- The plugin description claims “zero dependencies, zero processes, pure functions,” but verified information also indicates it depends on the DSH 0.1.2-alpha.1 profile environment and peer dependencies are provided via the profile’s healed
profiles/node_modulesfallback installation
Known limitations include:
- Evaluation results must be finite numbers;
NaN/Infinityare uniformly rejected - Trigonometric functions use radians
- Large integers are not supported: JavaScript
numberis IEEE 754 double, with precision loss beyond the safe integer range of±9e15 - Scientific notation is not supported:
1e5is rejected at the lexical level webandheadlessare different profiles; installing towebdoes not automatically overwriteheadless
Conclusion¶
dsh-tool-calculator provides a narrow-boundary, clearly purposeful calculator tool: it inputs mathematical expressions, outputs finite numbers, and rejects code-execution-type inputs.
Repository URL:
https://github.com/omdsh-dev/dsh-tool-calculator