Skip to main content
Glama
akutishevsky

LunchMoney MCP Server

get_all_categories

Read-only

Retrieve all categories from your LunchMoney account, sorted alphabetically, with options to return flattened or nested structures and filter by category groups.

Instructions

Get a list of all categories associated with the user's account. Returns categories in alphabetical order.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoIf `flattened`, returns a singular array of categories. If `nested`, returns top-level categories (either category groups or categories not part of a category group) in an array, with subcategories nested within the category group under the property children. Defaults to flattened.
is_groupNoIf true, returns only category groups. If false, returns only categories that are not category groups.

Implementation Reference

  • The tool 'get_all_categories' is registered via registerCategoryTools on the McpServer. The registration is triggered at server startup in src/index.ts (line 26).
    export function registerCategoryTools(server: McpServer) {
        server.registerTool(
            "get_all_categories",
            {
                description:
                    "Get a list of all categories associated with the user's account. Returns categories in alphabetical order.",
                inputSchema: {
                    format: z
                        .enum(["flattened", "nested"])
                        .optional()
                        .describe(
                            "If `flattened`, returns a singular array of categories. If `nested`, returns top-level categories (either category groups or categories not part of a category group) in an array, with subcategories nested within the category group under the property children. Defaults to flattened.",
                        ),
                    is_group: z
                        .boolean()
                        .optional()
                        .describe(
                            "If true, returns only category groups. If false, returns only categories that are not category groups.",
                        ),
                },
                annotations: {
                    readOnlyHint: true,
                },
            },
            async ({ format, is_group }) => {
                try {
                    const params = new URLSearchParams();
                    if (format) params.append("format", format);
                    if (is_group !== undefined)
                        params.append("is_group", String(is_group));
    
                    const qs = params.toString();
                    const response = await api.get(
                        `/categories${qs ? `?${qs}` : ""}`,
                    );
    
                    if (!response.ok) {
                        return handleApiError(
                            response,
                            "Failed to get all categories",
                        );
                    }
    
                    return dataResponse(await response.json());
                } catch (error) {
                    return catchError(error, "Failed to get all categories");
                }
            },
        );
  • Input validation schema for 'get_all_categories' using Zod. Accepts optional 'format' (flattened|nested) and optional 'is_group' (boolean).
    {
        description:
            "Get a list of all categories associated with the user's account. Returns categories in alphabetical order.",
        inputSchema: {
            format: z
                .enum(["flattened", "nested"])
                .optional()
                .describe(
                    "If `flattened`, returns a singular array of categories. If `nested`, returns top-level categories (either category groups or categories not part of a category group) in an array, with subcategories nested within the category group under the property children. Defaults to flattened.",
                ),
            is_group: z
                .boolean()
                .optional()
                .describe(
                    "If true, returns only category groups. If false, returns only categories that are not category groups.",
                ),
        },
        annotations: {
            readOnlyHint: true,
        },
    },
  • Handler function for 'get_all_categories'. Makes a GET request to /categories with optional query params (format, is_group), then returns the JSON response via dataResponse.
    async ({ format, is_group }) => {
        try {
            const params = new URLSearchParams();
            if (format) params.append("format", format);
            if (is_group !== undefined)
                params.append("is_group", String(is_group));
    
            const qs = params.toString();
            const response = await api.get(
                `/categories${qs ? `?${qs}` : ""}`,
            );
    
            if (!response.ok) {
                return handleApiError(
                    response,
                    "Failed to get all categories",
                );
            }
    
            return dataResponse(await response.json());
        } catch (error) {
            return catchError(error, "Failed to get all categories");
        }
    },
  • The 'api.get' helper used by the handler sends a GET request with retry logic, timeout, and authorization header to the LunchMoney API.
    export const api = {
        get: (path: string) => apiRequest("GET", path),
        post: (path: string, body?: unknown) => apiRequest("POST", path, body),
        put: (path: string, body: unknown) => apiRequest("PUT", path, body),
        delete: (path: string, body?: unknown) => apiRequest("DELETE", path, body),
        upload: (path: string, formData: FormData) =>
            apiUpload("POST", path, formData),
    };
  • The 'dataResponse' helper formats the API response data into TOON format for the MCP tool output.
    import { encode } from "@toon-format/toon";
    
    function stripNulls(value: unknown): unknown {
        if (value === null) return undefined;
        if (Array.isArray(value)) return value.map(stripNulls);
        if (typeof value === "object") {
            const result: Record<string, unknown> = {};
            for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
                if (v !== null) result[k] = stripNulls(v);
            }
            return result;
        }
        return value;
    }
    
    export function formatData(data: unknown): string {
        return encode(stripNulls(data));
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint=true, so read-only is covered. Description adds value by specifying alphabetical order and user-scoped data, beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no redundancy. Essential information front-loaded. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema; description does not specify return structure (e.g., array of objects, fields). Agent may need to infer category object shape. Adequate but not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers both parameters with 100% description coverage, including defaults and enum for format. Description does not add parameter details, but schema is sufficient. Baseline 3 justified.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb 'get', resource 'categories', scope 'user's account', and alphabetical ordering. Distinguishes from siblings like get_single_category and create_category.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use guidance. Does not mention alternatives like get_single_category or filter options. Minimal guidance, but the purpose is straightforward.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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