get_categories
Retrieve expense and income categories for a specific wallet to organize and classify financial transactions within the Money Lover personal finance app.
Instructions
Retrieve categories for a specific wallet.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | No | JWT token returned by the login tool or derived from EMAIL/PASSWORD environment variables | |
| walletId | Yes | Wallet identifier |
Implementation Reference
- src/server.js:373-380 (handler)MCP tool handler for 'get_categories': resolves token via runWithClient and delegates to MoneyloverClient.getCategories(walletId)async ({ token, walletId }) => { try { const data = (await runWithClient(token, client => client.getCategories(walletId))) ?? []; return formatSuccess({ categories: data }); } catch (error) { return formatError(error instanceof Error ? error : new Error(String(error))); } }
- src/server.js:362-372 (schema)Schema definition for get_categories tool: input requires optional token and walletId string; output is {categories: array of objects}{ title: 'Get Categories', description: 'Retrieve categories for a specific wallet.', inputSchema: { ...tokenArgument, walletId: z.string().min(1).describe('Wallet identifier') }, outputSchema: { categories: z.array(z.record(z.any())) } },
- src/server.js:360-381 (registration)Registration of the 'get_categories' tool on the MCP serverserver.registerTool( 'get_categories', { title: 'Get Categories', description: 'Retrieve categories for a specific wallet.', inputSchema: { ...tokenArgument, walletId: z.string().min(1).describe('Wallet identifier') }, outputSchema: { categories: z.array(z.record(z.any())) } }, async ({ token, walletId }) => { try { const data = (await runWithClient(token, client => client.getCategories(walletId))) ?? []; return formatSuccess({ categories: data }); } catch (error) { return formatError(error instanceof Error ? error : new Error(String(error))); } } );
- src/moneyloverClient.js:126-133 (helper)Core implementation of getCategories in MoneyloverClient: sends POST form request to /category/list endpoint with walletIdasync getCategories(walletId) { const form = new URLSearchParams(); form.set('walletId', ensureString(walletId, 'walletId')); return this.#post('/category/list', { body: form.toString(), headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }); }