get_user
Retrieve current user account details from LunchMoney to access personal finance information and manage financial data.
Instructions
Get details on the current user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/user.ts:6-36 (handler)The inline async handler function for the 'get_user' MCP tool. It fetches the current user's profile from the Lunchmoney API endpoint '/me' using the configured API token and returns the User object as a JSON string in the tool response content.server.tool("get_user", "Get details on the current user", {}, async () => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/me`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get user details: ${response.statusText}`, }, ], }; } const user: User = await response.json(); return { content: [ { type: "text", text: JSON.stringify(user), }, ], }; }); }
- src/types.ts:1-9 (schema)TypeScript interface defining the structure of the User object, which is fetched and returned by the get_user tool handler.export interface User { user_id: number; user_name: string; user_email: string; account_id: number; budget_name: string; primary_currency: string; api_key_label: string | null; }
- src/tools/user.ts:5-36 (registration)The registerUserTools function that registers the 'get_user' tool on the MCP server instance.export function registerUserTools(server: McpServer) { server.tool("get_user", "Get details on the current user", {}, async () => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/me`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get user details: ${response.statusText}`, }, ], }; } const user: User = await response.json(); return { content: [ { type: "text", text: JSON.stringify(user), }, ], }; }); }
- src/index.ts:23-23 (registration)Invocation of registerUserTools in the main server setup to register the get_user tool.registerUserTools(server);