get_all_assets
Retrieve all manually-managed financial assets from your LunchMoney account to track investments, properties, and other holdings.
Instructions
Get a list of all manually-managed assets associated with the user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/assets.ts:11-42 (handler)The handler function for the 'get_all_assets' tool. It fetches all assets from the Lunchmoney API endpoint `/assets` using the configured baseUrl and API token, handles errors by returning a text content error message, parses the response, type-annotates as Asset[], and returns the JSON-stringified list as text content.async () => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/assets`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get assets: ${response.statusText}`, }, ], }; } const data = await response.json(); const assets: Asset[] = data.assets; return { content: [ { type: "text", text: JSON.stringify(assets), }, ], }; }
- src/tools/assets.ts:7-43 (registration)Registers the 'get_all_assets' tool on the MCP server with the tool name, description, empty input schema object (no parameters), and the inline handler function.server.tool( "get_all_assets", "Get a list of all manually-managed assets associated with the user", {}, async () => { const { baseUrl, lunchmoneyApiToken } = getConfig(); const response = await fetch(`${baseUrl}/assets`, { headers: { Authorization: `Bearer ${lunchmoneyApiToken}`, }, }); if (!response.ok) { return { content: [ { type: "text", text: `Failed to get assets: ${response.statusText}`, }, ], }; } const data = await response.json(); const assets: Asset[] = data.assets; return { content: [ { type: "text", text: JSON.stringify(assets), }, ], }; } );
- src/index.ts:29-29 (registration)Invokes registerAssetTools on the MCP server instance, which in turn registers the 'get_all_assets' tool along with other asset-related tools.registerAssetTools(server);