Skip to main content
Glama

create_trip_budget

Set up a budget tracker for a trip by providing a trip ID, total budget, and optional currency code.

Instructions

Create a budget tracker for a trip.

Args: trip_id: Unique identifier for the trip (e.g. "tokyo-oct-2024") total_budget: Total budget amount currency: Currency code (default: "USD")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trip_idYes
total_budgetYes
currencyNoUSD

Implementation Reference

  • The @mcp.tool()-decorated handler for 'create_trip_budget'. Accepts trip_id (str), total_budget (float), and optional currency (str, default 'USD'), delegating to budget.create().
    @mcp.tool()
    def create_trip_budget(
        trip_id: str,
        total_budget: float,
        currency: str = "USD",
    ) -> dict:
        """
        Create a budget tracker for a trip.
    
        Args:
            trip_id: Unique identifier for the trip (e.g. "tokyo-oct-2024")
            total_budget: Total budget amount
            currency: Currency code (default: "USD")
        """
        return budget.create(trip_id, total_budget, currency)
  • The budget.create() function that implements the core logic: creates a BudgetRecord in the in-memory _budgets dict and returns a dict with trip_id, total_budget, currency, categories (initialized to zero), and a confirmation message.
    def create(trip_id: str, total_budget: float, currency: str = "USD") -> dict:
        record = BudgetRecord(trip_id=trip_id, total_budget=total_budget, currency=currency)
        _budgets[trip_id] = record
        return {
            "trip_id": trip_id,
            "total_budget": total_budget,
            "currency": currency,
            "categories": {cat: 0.0 for cat in CATEGORIES},
            "message": f"Budget of {currency} {total_budget:.2f} created for trip '{trip_id}'.",
        }
  • BudgetRecord Pydantic model — schema for in-memory storage of a trip budget including trip_id, total_budget, currency, and a list of Expense items.
    class BudgetRecord(BaseModel):
        trip_id: str
        total_budget: float
        currency: str
        expenses: list[Expense] = []
  • HTTP API route registration for the tool at /api/tools/create_trip_budget (POST), mapping to budget.create().
    @mcp.custom_route("/api/tools/create_trip_budget", methods=["POST"])
    async def api_create_trip_budget(request: Request) -> JSONResponse:
        body = await request.json()
        result = budget.create(body["trip_id"], body["total_budget"], body.get("currency", "USD"))
        return JSONResponse(result)
  • Expense Pydantic model — schema for individual expense entries with category, amount, and description fields.
    class Expense(BaseModel):
        category: str
        amount: float
        description: str
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states the action (create) without revealing side effects (e.g., overwrites existing budget), error handling for invalid trip_id, or return 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 very short and uses a clear bulleted Args list. No wasted words, but it could be slightly more structured (e.g., a brief note on behavior). It is efficient for the information provided.

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?

For a creation tool with 3 parameters and no output schema or annotations, the description covers purpose and parameter meanings but omits return value, idempotency, and error scenarios. It is minimally viable but incomplete.

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?

With 0% schema description coverage, the description adds meaning by explaining trip_id as 'Unique identifier for the trip' with an example, total_budget as 'Total budget amount,' and currency as 'Currency code' with default. It provides adequate context beyond the schema titles.

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 'Create a budget tracker for a trip,' using a specific verb and resource. It distinguishes from siblings like add_expense (adds an expense) and get_budget_summary (reads a summary).

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

Usage Guidelines3/5

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

The description implies the tool is used to set an initial budget for a trip but lacks explicit guidance on when to use it versus alternatives, prerequisites (e.g., trip must exist), or whether it overwrites existing budgets.

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/ismailrz/travel-mcp-server'

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