Get Wallets
get_walletsRetrieve all available wallets for authenticated users to manage personal finances and track expenses in Money Lover.
Instructions
List all wallets accessible to the authenticated user.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | No | JWT token returned by the login tool or derived from EMAIL/PASSWORD environment variables |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallets | Yes |
Implementation Reference
- src/server.js:340-358 (registration)Registers the 'get_wallets' tool with the MCP server, providing title, description, input/output schemas, and the handler function.
server.registerTool( 'get_wallets', { title: 'Get Wallets', description: 'List all wallets accessible to the authenticated user.', inputSchema: tokenArgument, outputSchema: { wallets: z.array(z.record(z.any())) } }, async ({ token }) => { try { const wallets = (await runWithClient(token, client => client.getWallets())) ?? []; return formatSuccess({ wallets }); } catch (error) { return formatError(error instanceof Error ? error : new Error(String(error))); } } ); - src/server.js:350-357 (handler)The main handler function for the 'get_wallets' tool, which resolves authentication token, invokes the client.getWallets() via runWithClient utility, handles errors, and formats the response.
async ({ token }) => { try { const wallets = (await runWithClient(token, client => client.getWallets())) ?? []; return formatSuccess({ wallets }); } catch (error) { return formatError(error instanceof Error ? error : new Error(String(error))); } } - src/server.js:342-349 (schema)Schema definition for the 'get_wallets' tool, specifying input (token) and output (wallets array). Uses shared tokenArgument.
{ title: 'Get Wallets', description: 'List all wallets accessible to the authenticated user.', inputSchema: tokenArgument, outputSchema: { wallets: z.array(z.record(z.any())) } }, - src/server.js:317-321 (schema)Shared schema definition for the token input argument used across tools including get_wallets.
const tokenArgument = { token: tokenSchema.describe( 'JWT token returned by the login tool or derived from EMAIL/PASSWORD environment variables' ) }; - src/moneyloverClient.js:122-124 (helper)Helper method in MoneyloverClient class that performs the actual API call to fetch wallets by POSTing to '/wallet/list' endpoint.
async getWallets() { return this.#post('/wallet/list'); }