Skip to main content
Glama

check_budget

Monitor safety budget utilization for AI agent certifications, showing limits, current usage, and rate enforcement status.

Instructions

Check the current safety budget utilization.

This tool returns the current state of the safety budget, including:

  • Total budget limit (resets on schedule)

  • Amount used in current period

  • Number of certifications performed

  • Rate limit enforcement status

Returns: Dictionary with keys: - budget_limit: Total safety budget [tokens/actions] - budget_used: Amount consumed in current period - budget_remaining: budget_limit - budget_used (clamped to >= 0) - rate_limit: Maximum certifications per period - total_certifications: Total number of certifications performed - utilization_percent: (budget_used / budget_limit) * 100 - timestamp: Current time (ISO 8601)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The implementation of the check_budget tool, which calculates and returns the current safety budget status.
    def check_budget() -> Dict[str, Any]:
        """
        Check the current safety budget utilization.
    
        This tool returns the current state of the safety budget, including:
        - Total budget limit (resets on schedule)
        - Amount used in current period
        - Number of certifications performed
        - Rate limit enforcement status
    
        Returns:
            Dictionary with keys:
            - budget_limit: Total safety budget [tokens/actions]
            - budget_used: Amount consumed in current period
            - budget_remaining: budget_limit - budget_used (clamped to >= 0)
            - rate_limit: Maximum certifications per period
            - total_certifications: Total number of certifications performed
            - utilization_percent: (budget_used / budget_limit) * 100
            - timestamp: Current time (ISO 8601)
        """
        try:
            _get_certifier()  # Ensure initialized
    
            utilization = _adapter.budget_utilization()
            budget_used = utilization * _BUDGET_LIMIT
            budget_remaining = max(0.0, _BUDGET_LIMIT - budget_used)
    
            response = {
                "budget_limit": _BUDGET_LIMIT,
                "budget_used": round(budget_used, 2),
                "budget_remaining": round(budget_remaining, 2),
                "budget_utilization": round(utilization, 4),
                "rate_limit": _RATE_LIMIT,
                "total_certifications": _total_certifications,
                "utilization_percent": round(utilization * 100, 2),
                "timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
            }
    
            logger.info(
                f"Budget check: {response['budget_remaining']:.1f}/"
                f"{response['budget_limit']:.1f} remaining"
            )
    
            return response
    
        except Exception as e:
            logger.error(f"Error in check_budget: {e}")
            return {
                "error": f"Failed to check budget: {str(e)}",
                "timestamp": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
            }
  • Registration of the check_budget tool using the @server.tool() decorator.
    @server.tool()
Behavior4/5

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

With no annotations provided, description carries full behavioral disclosure burden. Excellent coverage: specifies reset schedule ('resets on schedule'), calculation logic ('clamped to >= 0'), rate limiting enforcement status, and precise return structure including ISO 8601 timestamp format.

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?

Well-structured with clear visual separation between purpose statement and return value specification. Front-loaded with the core action. Detailed return dictionary is verbose but justified given budget monitoring requires precise field definitions.

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?

Comprehensive coverage for a zero-parameter read operation. Despite existence of output schema (per context signals), description ensures completeness by documenting all return fields, calculations, and temporal behaviors (reset schedules) that might not be visible in schema alone.

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?

Zero parameters present; baseline score of 4 applies per rubric. Description appropriately does not fabricate parameter semantics where none exist.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb ('Check') and resource ('safety budget utilization'). Implies read-only status check distinct from sibling 'certify_action' (which performs mutations) by framing itself as state retrieval and referencing certifications as metadata rather than actions.

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

Usage Guidelines2/5

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

No explicit when-to-use guidance or comparison to siblings. Does not advise calling this before 'certify_action' to validate budget availability, though the return structure implies this use case.

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/tb8412/qae-claude-mcp-example'

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