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
| Name | Required | Description | Default |
|---|---|---|---|
| category_id | Yes | ||
| staff_id | Yes | ||
| amount | Yes | ||
| date | Yes | ||
| vendor | No | ||
| notes | No | ||
| currency_code | No | USD | |
| client_id | No |
Implementation Reference
- src/mcp_freshbooks/server.py:288-314 (handler)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}"