Skip to main content
Glama

create_expense

Add business expenses to FreshBooks by specifying amount, date, category, and staff details for accurate financial tracking.

Instructions

Create a new expense. Amount as string (e.g. '150.00'). Date as YYYY-MM-DD.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_idYes
staff_idYes
amountYes
dateYes
vendorNo
notesNo
currency_codeNoUSD
client_idNo

Implementation Reference

  • The create_expense function acts as the handler for the 'create_expense' tool. It constructs the expense data, calls the accounting_create method via the client, and returns a confirmation message with the new expense ID.
    async def create_expense(
        category_id: int,
        staff_id: int,
        amount: str,
        date: str,
        vendor: str = "",
        notes: str = "",
        currency_code: str = "USD",
        client_id: int | None = None,
    ) -> str:
        """Create a new expense. Amount as string (e.g. '150.00'). Date as YYYY-MM-DD."""
        data = {
            "categoryid": category_id,
            "staffid": staff_id,
            "amount": {"amount": amount, "code": currency_code},
            "date": date,
        }
        if vendor:
            data["vendor"] = vendor
        if notes:
            data["notes"] = notes
        if client_id:
            data["clientid"] = client_id
        result = await client.accounting_create("expenses/expenses", "expense", data)
        e = result.get("expense", result)
        return f"Expense created (ID: {e.get('id')}). Amount: ${amount}"

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/AlexlaGuardia/MCP-Freshbooks'

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