get_net_worth
Retrieve current net worth with detailed breakdown of assets and liabilities from Monarch Money financial data.
Instructions
Get current net worth and assets/liabilities breakdown
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:435-494 (handler)The main handler function getNetWorth() that implements the tool logic. It fetches accounts, categorizes them as assets or liabilities based on account type group, calculates totals and net worth, and returns a detailed breakdown with account lists.private async getNetWorth(): Promise<any> { try { const accounts = await this.api.getAccounts(); let totalAssets = 0; let totalLiabilities = 0; const assetAccounts: any[] = []; const liabilityAccounts: any[] = []; accounts?.forEach((account: Account) => { if (!account.includeInNetWorth) { return; // Skip accounts not included in net worth } const balance = account.currentBalance || 0; const accountGroup = account.type?.group?.toLowerCase() || ''; if (accountGroup === 'asset') { totalAssets += balance; assetAccounts.push({ name: account.displayName, type: account.type?.name, balance: balance, }); } else if (accountGroup === 'liability') { totalLiabilities += Math.abs(balance); liabilityAccounts.push({ name: account.displayName, type: account.type?.name, balance: balance, }); } }); const netWorth = totalAssets - totalLiabilities; return { success: true, data: { netWorth, totalAssets, totalLiabilities, assetAccounts, liabilityAccounts, }, summary: `Net worth: $${netWorth.toFixed( 2 )} (Assets: $${totalAssets.toFixed( 2 )}, Liabilities: $${totalLiabilities.toFixed(2)})`, }; } catch (error) { throw new Error( `Failed to get net worth: ${ error instanceof Error ? error.message : 'Unknown error' }` ); } }
- src/tools.ts:122-130 (schema)Tool registration schema defining get_net_worth with its description and input schema (empty object with no required parameters).{ name: 'get_net_worth', description: 'Get current net worth and assets/liabilities breakdown', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/tools.ts:224-225 (registration)Case statement in executeTool() method that routes the 'get_net_worth' tool name to the getNetWorth() handler method.case 'get_net_worth': return await this.getNetWorth();