Skip to main content
Glama
MerchantGuard

agentguard

Official

spend_decide

Gate AI model calls before execution using token metadata, returning allow/block decisions with signed provenance receipts to enforce spend caps without exposing prompt content.

Instructions

Gate a model call BEFORE it runs. Pass metadata only (model, token counts, endpoint URL), never prompt content. Returns allow/block plus an Ed25519-signed, content-free receipt with model and hosting provenance (weights origin, jurisdiction, retention). Unknown self-hosted models need set_model_cost first (fail-closed). Optional agent_id, task_id and workflow_id accept identifiers only; spend_decide binds them into the signed actor. Read-only and cost-configuration tools accept these fields without recording a spend decision.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesModel name, e.g. llama-3.1-8b-instruct or gpt-5-mini
task_idNoOptional task identifier; signed as actor.taskId on spend_decide
agent_idNoOptional agent identifier; signed as actor.agentId on spend_decide
workflow_idNoOptional workflow identifier; signed as actor.workflowId on spend_decide
endpoint_urlNoEndpoint URL. Unrecognized endpoints route as self-hosted (zero retention, your jurisdiction).
input_tokensYesProjected input tokens
output_tokensYesProjected output tokens

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.1

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It fully discloses the return format (allow/block + Ed25519-signed receipt), provenance content (weights origin, jurisdiction, retention), privacy stance (content-free, never prompt content), fail-closed behavior for unknown self-hosted models, and how optional identifiers are bound into the signed actor. This is far richer than the typical 'updates settings' description.

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?

Five sentences, each earning its place: purpose, metadata constraint, return value/provenance, prerequisite, and identifier semantics. The main action is front-loaded ('Gate a model call BEFORE it runs'), and there is no filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 7 parameters and no output schema, so the description must cover return values and edge behavior. It explains the allow/block decision, the signed receipt with provenance, fail-closed behavior, and identifier restrictions. It does not describe every error path, but for a gating tool the core context an agent needs to call it correctly is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds meaningful semantics: it classifies model, token counts, and endpoint_url as metadata, warns never to pass prompt content, restricts agent_id/task_id/workflow_id to identifiers, and clarifies that unrecognized endpoint_urls route as self-hosted. This goes beyond the schema's per-parameter descriptions, though it doesn't exhaustively elaborate every field.

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?

The description opens with a specific verb and resource: 'Gate a model call BEFORE it runs.' This clearly states what the tool does and distinguishes it from siblings like spend_status (status reporting), export_receipts (exporting), and verify_receipt (verification). The return value (allow/block plus a signed receipt) further pins down its unique role.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool ('before a model call runs'), what to pass ('metadata only... never prompt content'), and names a prerequisite alternative: 'Unknown self-hosted models need set_model_cost first (fail-closed).' It also clarifies that read-only and cost-configuration tools accept the optional fields without recording a spend decision, giving agents a clear decision boundary.

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