update_manual_crypto
Update a manual crypto asset's balance and optional details in Lunch Money. Requires the asset ID from a manual crypto list.
Instructions
Update a manually-managed crypto asset via the v1 crypto endpoint. The id must be from a get_all_crypto result with source=manual.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| crypto_id | Yes | ID of the manual crypto asset to update. Synced crypto assets cannot be updated. | |
| balance | Yes | Updated balance of the crypto account. | |
| name | No | Optional official or full name of the account. | |
| display_name | No | Optional display name for the account. | |
| institution_name | No | Optional provider that holds the asset. | |
| currency | No | Optional supported cryptocurrency code. |
Implementation Reference
- src/tools/crypto.ts:73-110 (handler)Handler function for update_manual_crypto tool. Calls PUT /crypto/manual/{crypto_id} with balance (required), and optional name, display_name, institution_name, and currency fields.
async ({ crypto_id, balance, name, display_name, institution_name, currency, }) => { try { const body: Record<string, unknown> = { balance: balance.toString(), }; if (name !== undefined) body.name = name; if (display_name !== undefined) body.display_name = display_name; if (institution_name !== undefined) body.institution_name = institution_name; if (currency !== undefined) body.currency = currency; const response = await apiV1.put( `/crypto/manual/${crypto_id}`, body, ); if (!response.ok) { return handleApiError( response, "Failed to update crypto asset", ); } return dataResponse(await response.json()); } catch (error) { return catchError(error, "Failed to update crypto asset"); } }, ); - src/tools/crypto.ts:40-68 (schema)Input schema for update_manual_crypto. Defines required crypto_id (number) and balance (number), plus optional name (max 45), display_name (max 25), institution_name (max 50), and currency (string).
inputSchema: { crypto_id: z.coerce .number() .describe( "ID of the manual crypto asset to update. Synced crypto assets cannot be updated.", ), balance: z.coerce .number() .describe("Updated balance of the crypto account."), name: z .string() .max(45) .optional() .describe("Optional official or full name of the account."), display_name: z .string() .max(25) .optional() .describe("Optional display name for the account."), institution_name: z .string() .max(50) .optional() .describe("Optional provider that holds the asset."), currency: z .string() .optional() .describe("Optional supported cryptocurrency code."), }, - src/tools/crypto.ts:35-110 (registration)Registration of update_manual_crypto tool via server.registerTool(), called by registerCryptoTools() which is invoked from src/index.ts line 33.
server.registerTool( "update_manual_crypto", { description: "Update a manually-managed crypto asset via the v1 crypto endpoint. The id must be from a get_all_crypto result with source=manual.", inputSchema: { crypto_id: z.coerce .number() .describe( "ID of the manual crypto asset to update. Synced crypto assets cannot be updated.", ), balance: z.coerce .number() .describe("Updated balance of the crypto account."), name: z .string() .max(45) .optional() .describe("Optional official or full name of the account."), display_name: z .string() .max(25) .optional() .describe("Optional display name for the account."), institution_name: z .string() .max(50) .optional() .describe("Optional provider that holds the asset."), currency: z .string() .optional() .describe("Optional supported cryptocurrency code."), }, annotations: { idempotentHint: true, }, }, async ({ crypto_id, balance, name, display_name, institution_name, currency, }) => { try { const body: Record<string, unknown> = { balance: balance.toString(), }; if (name !== undefined) body.name = name; if (display_name !== undefined) body.display_name = display_name; if (institution_name !== undefined) body.institution_name = institution_name; if (currency !== undefined) body.currency = currency; const response = await apiV1.put( `/crypto/manual/${crypto_id}`, body, ); if (!response.ok) { return handleApiError( response, "Failed to update crypto asset", ); } return dataResponse(await response.json()); } catch (error) { return catchError(error, "Failed to update crypto asset"); } }, ); - src/api.ts:155-160 (helper)apiV1 helper used by the handler to make the PUT request to the v1 dev endpoint (https://dev.lunchmoney.app/v1).
export const apiV1 = { get: (path: string) => apiRequest("GET", path, undefined, "https://dev.lunchmoney.app/v1"), put: (path: string, body: unknown) => apiRequest("PUT", path, body, "https://dev.lunchmoney.app/v1"), }; - src/types.ts:135-148 (helper)CryptoAsset type definition used by the get_all_crypto tool (referenced in tool description for update_manual_crypto).
export interface CryptoAsset { id?: number | null; zabo_account_id?: number | null; source: "manual" | "synced"; name: string; display_name: string | null; balance: string; balance_as_of?: string; currency: string; status: string; institution_name: string | null; created_at: string; to_base?: number | null; }