Skip to main content
Glama

budget_spend

Deduct tokens from a global budget on behalf of an agent, tracking individual spend. Returns approval or a denial reason if the ceiling would be exceeded.

Instructions

Deduct tokens from the global FederatedBudget on behalf of an agent. Returns {ok:true, allowed:true, spent, remaining} when approved, or {ok:true, allowed:false, deniedReason, remaining} when the ceiling would be exceeded. Returns {ok:false, error:"..."} if tokens is not a positive integer. tokens represents the estimated cost of the upcoming LLM call — pass the expected usage before invoking the model; agent_id is tracked individually in the spend log and reported by budget_status. Call budget_status first to check remaining balance; never attempt an LLM call after receiving allowed:false.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe agent spending tokens
tokensYesNumber of tokens to spend (positive integer)
Behavior4/5

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

With no annotations, description discloses three return cases (success, denied, error) and agent tracking. Could mention authorization requirements, but covers the main behavioral aspects well.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single paragraph packs information efficiently, but could be better structured (e.g., bullet points for return cases). Not overly verbose, though.

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?

No output schema, but description explains full return structure, error handling, and prescriptive usage flow. Connects to budget_status sibling, making it complete for safe invocation.

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

Parameters5/5

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

Schema coverage is 100%, but the description adds significant context: tokens are the estimated cost of LLM call to be passed before model invocation; agent_id is tracked in spend log and reported by budget_status.

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 clearly states it deducts tokens from a global FederatedBudget on behalf of an agent. It distinguishes from sibling tools like budget_status by explicitly advising to check balance first before spending.

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?

Provides explicit guidance: call budget_status first, pass expected usage tokens before invoking model, and never attempt LLM call after receiving allowed:false.

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/Jovancoding/network-ai'

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