Skip to main content
Glama
Bristlecone2026

Bristlecone Logic Utilities

eval_expression

Read-onlyIdempotent

Evaluate arithmetic and logical expressions in a secure AST sandbox to prevent calculation errors and block arbitrary code execution.

Instructions

Deterministically evaluates arithmetic, mathematical, and logical expressions inside an AST-isolated sandbox. Prevents LLM calculation errors while strictly blocking arbitrary code execution. Use for reliable numerical calculations and boolean logic. Do not use for executing arbitrary Python statements or importing external libraries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesA valid mathematical, arithmetic, or boolean expression string (e.g. '((150 * 12) / 4) + 18.5').

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.3
    • changedOutput schema / (root)
      Previous value: -{
      -  "properties": {
      -    "expression": {
      -      "type": "string"
      -    },
      -    "result": {
      -      "type": [
      -        "number",
      -        "boolean",
      -        "null"
      -      ]
      -    },
      -    "success": {
      -      "type": "boolean"
      -    }
      -  },
      -  "required": [
      -    "expression",
      -    "result",
      -    "success"
      -  ],
      -  "type": "object"
      -}New value: +null
  2. First observedv0.3.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare readOnly, idempotent, and non-destructive, but the description adds critical behavioral context: deterministic evaluation, AST-isolated sandboxing, and strict blocking of arbitrary code execution. This goes well beyond the safety hints and is essential for an agent to trust the tool.

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?

Four tight sentences: the core operation is front-loaded, followed by the value proposition, usage guidance, and exclusions. No redundant or filler text.

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 low complexity and rich schema/annotations, the description covers purpose, usage, and constraints well. However, with no output schema, it does not mention what the tool returns (e.g., a numeric/boolean value or an error object), leaving a small gap for an agent invoking it.

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 coverage is 100% and the single parameter is fully described with an example. The description does not add any syntax, format, or constraint details beyond what the schema already provides, so the baseline of 3 is appropriate.

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?

States a specific verb (evaluates) and resource (arithmetic, mathematical, and logical expressions) with the scope of an AST-isolated sandbox. Clearly distinguishes itself from any code-execution tool by specifying what it does and does not support.

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?

Gives explicit when-to-use (reliable numerical calculations and boolean logic) and when-not-to-use (executing arbitrary Python statements or importing external libraries). Does not name an alternative tool, but none of the siblings provide comparable functionality, so the exclusion is clear enough.

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