Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

update_manual_crypto

Update the balance of a manually-tracked cryptocurrency asset in your LunchMoney financial data to maintain accurate portfolio tracking.

Instructions

Update a manually-managed cryptocurrency asset balance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • Handler function that updates a manual cryptocurrency asset balance by making a PUT request to the LunchMoney API endpoint `/crypto/manual/{crypto_id}` with the provided balance.
    async ({ input }) => {
        const { baseUrl, lunchmoneyApiToken } = getConfig();
        
        const body: any = {};
        
        if (input.balance !== undefined) {
            body.balance = input.balance.toString();
        }
        
        const response = await fetch(`${baseUrl}/crypto/manual/${input.crypto_id}`, {
            method: "PUT",
            headers: {
                Authorization: `Bearer ${lunchmoneyApiToken}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify(body),
        });
    
        if (!response.ok) {
            return {
                content: [
                    {
                        type: "text",
                        text: `Failed to update crypto asset: ${response.statusText}`,
                    },
                ],
            };
        }
    
        const result = await response.json();
        
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(result),
                },
            ],
        };
    }
  • Zod schema defining the input parameters: crypto_id (required number) and balance (optional number).
    input: z.object({
        crypto_id: z
            .number()
            .describe("ID of the crypto asset to update"),
        balance: z
            .number()
            .optional()
            .describe("Updated balance of the crypto asset"),
    }),
  • Registration of the 'update_manual_crypto' tool using server.tool(), including name, description, schema, and handler.
    server.tool(
        "update_manual_crypto",
        "Update a manually-managed cryptocurrency asset balance",
        {
            input: z.object({
                crypto_id: z
                    .number()
                    .describe("ID of the crypto asset to update"),
                balance: z
                    .number()
                    .optional()
                    .describe("Updated balance of the crypto asset"),
            }),
        },
        async ({ input }) => {
            const { baseUrl, lunchmoneyApiToken } = getConfig();
            
            const body: any = {};
            
            if (input.balance !== undefined) {
                body.balance = input.balance.toString();
            }
            
            const response = await fetch(`${baseUrl}/crypto/manual/${input.crypto_id}`, {
                method: "PUT",
                headers: {
                    Authorization: `Bearer ${lunchmoneyApiToken}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify(body),
            });
    
            if (!response.ok) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `Failed to update crypto asset: ${response.statusText}`,
                        },
                    ],
                };
            }
    
            const result = await response.json();
            
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(result),
                    },
                ],
            };
        }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/akutishevsky/lunchmoney-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server