Skip to main content
Glama
jstibal

Openterms-mcp

simulate_policy

Test whether a hypothetical action would be allowed by current policy without issuing a receipt. Pre-check API calls, data access, purchases, or custom actions before proceeding.

Instructions

Test whether a hypothetical action would be allowed by the current policy WITHOUT actually issuing a receipt. Use this to pre-check before acting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
action_typeYes
terms_urlYesURL of the terms
action_contextNoOptional context metadata

Implementation Reference

  • The handler logic for the 'simulate_policy' tool, which sends a POST request to '/v1/policy/simulate' and formats the response.
    elif name == "simulate_policy":
        payload = {
            "payload": {
                "action_type": arguments["action_type"],
                "terms_url": arguments["terms_url"],
            }
        }
        if arguments.get("action_context"):
            payload["payload"]["action_context"] = arguments["action_context"]
    
        resp = client.post("/v1/policy/simulate", json=payload, headers=_headers())
        if resp.status_code == 200:
            result = resp.json()
            decision = result.get("decision", "unknown")
            icon = {"allow": "βœ…", "deny": "🚫", "escalate": "⏸️"}.get(decision, "❓")
            lines = [f"{icon} Simulation result: {decision.upper()}"]
            reasons = result.get("reasons", [])
            if reasons:
                lines.append(f"  Reasons: {', '.join(reasons)}")
            for rr in result.get("rule_results", []):
                lines.append(f"  Rule {rr.get('rule_index', '?')}: {rr.get('rule_type')} β†’ {rr.get('decision')}")
            ctx = result.get("context", {})
            if ctx:
                lines.append(f"  Context: daily_spend={ctx.get('daily_spend', 0)}, balance={ctx.get('current_balance', 0)}")
            return "\n".join(lines)
        return _format_error(resp)
  • The tool schema definition for 'simulate_policy', describing its purpose and required input parameters.
    {
        "name": "simulate_policy",
        "description": (
            "Test whether a hypothetical action would be allowed by the current policy "
            "WITHOUT actually issuing a receipt. Use this to pre-check before acting."
        ),
        "inputSchema": {
            "type": "object",
            "required": ["action_type", "terms_url"],
            "properties": {
                "action_type": {"type": "string", "enum": ["api_call", "data_access", "purchase", "custom"]},
                "terms_url": {"type": "string", "description": "URL of the terms"},
                "action_context": {"type": "object", "description": "Optional context metadata"},
            },
        },
    },
Behavior3/5

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

No annotations provided, so description carries full burden. It successfully discloses the key behavioral trait that this is a simulation ('WITHOUT actually issuing a receipt'). However, it omits return format (boolean vs object), error conditions, and rate limiting details expected for a tool with no annotation coverage.

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?

Two sentences, both essential. First defines capability and key distinction; second provides usage guidance. No redundancy or filler. Front-loaded with critical information.

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 no annotations and no output schema, the description adequately covers core purpose and distinguishes from siblings. However, it lacks description of return values (what does 'allowed' look like in the response?) and error handling, leaving gaps for a 3-parameter tool with nested objects.

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 67% (2/3 parameters described). The description implies parameter usage through 'hypothetical action' and 'current policy' but doesn't add specific syntax, format examples, or clarify the relationship between 'terms_url' and 'current policy' beyond what the schema already provides. Baseline 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?

Description uses specific verb 'Test' with clear resource (hypothetical action against current policy). Explicitly distinguishes from sibling 'issue_receipt' by stating 'WITHOUT actually issuing a receipt', clarifying this is a dry-run simulation.

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?

Provides clear usage context ('Use this to pre-check before acting') implying when to use it. However, it doesn't explicitly name the alternative tool (issue_receipt) for actual execution, only implies it through negation.

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

Install Server

Other Tools

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/jstibal/openterms-mcp'

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