Skip to main content
Glama

get_budget

Retrieve detailed budget information from Oracle Cloud Infrastructure, including targets, alert rules, and spend tracking data for cost management.

Instructions

Get detailed information about a specific budget.

Args:
    budget_id: OCID of the budget to retrieve

Returns:
    Detailed budget information including targets, alert rules, and spend tracking

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
budget_idYes

Implementation Reference

  • The main MCP tool handler function 'mcp_get_budget' registered with name 'get_budget'. It uses the pre-initialized OCI budget client and calls the helper function to retrieve and return budget details.
    @mcp.tool(name="get_budget")
    @mcp_tool_wrapper(
        start_msg="Getting budget details for {budget_id}...",
        success_msg="Retrieved budget details successfully",
        error_prefix="Error getting budget details"
    )
    async def mcp_get_budget(ctx: Context, budget_id: str) -> Dict[str, Any]:
        """
        Get detailed information about a specific budget.
    
        Args:
            budget_id: OCID of the budget to retrieve
    
        Returns:
            Detailed budget information including targets, alert rules, and spend tracking
        """
        return get_budget(oci_clients["budget"], budget_id)
  • Supporting helper function that executes the core OCI API call to retrieve budget details and formats the response dictionary.
    def get_budget(budget_client: oci.budget.BudgetClient, budget_id: str) -> Dict[str, Any]:
        """
        Get details of a specific budget.
    
        Args:
            budget_client: OCI Budget client
            budget_id: OCID of the budget
    
        Returns:
            Details of the budget
        """
        try:
            budget = budget_client.get_budget(budget_id).data
    
            budget_details = {
                "id": budget.id,
                "display_name": budget.display_name,
                "description": budget.description,
                "compartment_id": budget.compartment_id,
                "target_compartment_id": budget.target_compartment_id,
                "target_type": budget.target_type,
                "targets": budget.targets,
                "amount": budget.amount,
                "reset_period": budget.reset_period,
                "budget_processing_period_start_offset": budget.budget_processing_period_start_offset,
                "processing_period_type": budget.processing_period_type,
                "lifecycle_state": budget.lifecycle_state,
                "alert_rule_count": budget.alert_rule_count,
                "version": budget.version,
                "actual_spend": budget.actual_spend,
                "forecasted_spend": budget.forecasted_spend,
                "time_spend_computed": str(budget.time_spend_computed) if budget.time_spend_computed else None,
                "time_created": str(budget.time_created),
                "time_updated": str(budget.time_updated),
            }
    
            logger.info(f"Retrieved details for budget {budget_id}")
            return budget_details
    
        except Exception as e:
            logger.exception(f"Error getting budget details: {e}")
            raise
  • The @mcp.tool decorator registers the handler function with the name 'get_budget'.
    @mcp.tool(name="get_budget")
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states this is a read operation ('Get'), which implies it's non-destructive, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or what 'detailed information' entails beyond the high-level mention of targets, alert rules, and spend tracking. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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?

The description is appropriately sized and front-loaded: the first sentence states the purpose clearly, followed by structured 'Args' and 'Returns' sections. There's no wasted text, though the 'Returns' section could be more detailed given the lack of output schema. Overall, it's efficient and well-organized.

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 the tool's low complexity (1 parameter, no nested objects) but lack of annotations and output schema, the description is moderately complete. It covers the basic purpose and parameter semantics but lacks details on behavioral aspects, error handling, and the full scope of return values. For a simple read tool, this is adequate but with clear gaps in transparency.

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?

The description adds meaningful context for the single parameter: it specifies that 'budget_id' is an 'OCID of the budget to retrieve,' which clarifies the parameter's purpose and format beyond the schema's minimal title ('Budget Id'). With schema description coverage at 0% and only one parameter, this compensation is effective, though it doesn't cover edge cases or examples.

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?

The description clearly states the tool's purpose: 'Get detailed information about a specific budget.' It uses a specific verb ('Get') and resource ('budget'), but doesn't explicitly differentiate from sibling tools like 'list_budgets' or 'get_cost_by_compartment' beyond the 'specific budget' qualifier. This is clear but lacks explicit sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'list_budgets' for listing all budgets or 'get_cost_by_compartment' for cost-related queries, nor does it specify prerequisites or contexts for retrieving a specific budget. Usage is implied by the parameter requirement but not explicitly stated.

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/jopsis/mcp-server-oci'

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