add_expense
Track expenses for social events by adding payments made by members. Input gathering ID, member name, and amount to manage reimbursements and settle balances effectively.
Instructions
Add an expense for a member
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount paid by the member | |
| gathering_id | Yes | ID of the gathering | |
| member_name | Yes | Name of the member who paid |
Implementation Reference
- src/index.ts:82-103 (registration)Registers the 'add_expense' MCP tool with name, description, and input schema in the listTools response.{ name: 'add_expense', description: 'Add an expense for a member', inputSchema: { type: 'object', properties: { gathering_id: { type: 'string', description: 'ID of the gathering', }, member_name: { type: 'string', description: 'Name of the member who paid', }, amount: { type: 'number', description: 'Amount paid by the member', }, }, required: ['gathering_id', 'member_name', 'amount'], }, },
- src/index.ts:302-307 (handler)Executes the 'add_expense' tool by validating input arguments and constructing the CLI command to invoke the Python backend.case 'add_expense': if (!isExpenseArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid add_expense arguments'); } command += ` add-expense "${args.gathering_id}" "${args.member_name}" ${args.amount}`; break;
- src/index.ts:269-273 (helper)Type guard function used to validate the arguments for the 'add_expense' tool.const isExpenseArgs = (args: any): args is { gathering_id: string; member_name: string; amount: number } => typeof args === 'object' && args !== null && typeof args.gathering_id === 'string' && typeof args.member_name === 'string' && typeof args.amount === 'number';