Skip to main content
Glama

delete_flow

Delete cash flow entries for a given period. Specify a category to remove a single entry, or omit it to clear all entries for that month.

Instructions

Delete flow entries for a period. If category is provided, only that single entry is removed; otherwise all entries for the period are deleted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodYesYYYY-MM
typeNoRequired when category is provided
sub_typeNoRequired when category is provided
categoryNoSpecific category — if omitted, deletes all entries for the period

Implementation Reference

  • The actual handler function for the 'delete_flow' MCP tool. It deletes flow entries from the database. If a 'category' is provided (along with required 'type' and 'sub_type'), it deletes a single specific entry matching all four fields. Otherwise, it deletes all flow entries for the given 'period'. Returns success with deleted count or an error if nothing matched.
    async ({ period, type, sub_type, category }) => {
      const db = getDb();
      if (category) {
        if (!type || !sub_type)
          return err('type and sub_type are required when category is provided');
        const res = db
          .delete(flowEntries)
          .where(
            and(
              eq(flowEntries.period, period),
              eq(flowEntries.type, type),
              eq(flowEntries.sub_type, sub_type),
              eq(flowEntries.category, category),
            ),
          )
          .run();
        if (res.changes === 0) return err(`No flow entry matched`);
        return ok({ deleted: res.changes, period, category });
      }
      const res = db.delete(flowEntries).where(eq(flowEntries.period, period)).run();
      if (res.changes === 0) return err(`No flow entries for ${period}`);
      return ok({ deleted: res.changes, period });
    },
  • Zod schema (input validation) for the 'delete_flow' tool. Defines the expected parameters: 'period' (YYYY-MM, required), 'type' (income/expense, optional but required when category provided), 'sub_type' (optional but required when category provided), and 'category' (optional string, if omitted deletes all entries for the period).
    {
      period: z.string().describe('YYYY-MM'),
      type: z.enum(['income', 'expense']).optional().describe('Required when category is provided'),
      sub_type: z.string().optional().describe('Required when category is provided'),
      category: z
        .string()
        .optional()
        .describe('Specific category — if omitted, deletes all entries for the period'),
    },
  • Registration of the 'delete_flow' tool on the MCP server via server.tool(). Nested inside the registerMutateTools function (line 12). The call includes the tool name, description, Zod input schema, and the handler callback.
    server.tool(
      'delete_flow',
      'Delete flow entries for a period. If category is provided, only that single entry is removed; otherwise all entries for the period are deleted.',
      {
        period: z.string().describe('YYYY-MM'),
        type: z.enum(['income', 'expense']).optional().describe('Required when category is provided'),
        sub_type: z.string().optional().describe('Required when category is provided'),
        category: z
          .string()
          .optional()
          .describe('Specific category — if omitted, deletes all entries for the period'),
      },
      async ({ period, type, sub_type, category }) => {
        const db = getDb();
        if (category) {
          if (!type || !sub_type)
            return err('type and sub_type are required when category is provided');
          const res = db
            .delete(flowEntries)
            .where(
              and(
                eq(flowEntries.period, period),
                eq(flowEntries.type, type),
                eq(flowEntries.sub_type, sub_type),
                eq(flowEntries.category, category),
              ),
            )
            .run();
          if (res.changes === 0) return err(`No flow entry matched`);
          return ok({ deleted: res.changes, period, category });
        }
        const res = db.delete(flowEntries).where(eq(flowEntries.period, period)).run();
        if (res.changes === 0) return err(`No flow entries for ${period}`);
        return ok({ deleted: res.changes, period });
      },
    );
  • Helper functions 'ok' and 'err' used by the delete_flow handler to format success (as JSON text) and error (with isError flag) responses.
    export const ok = (data: unknown) => ({
      content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
    });
    
    export const err = (msg: string) => ({
      content: [{ type: 'text' as const, text: `Error: ${msg}` }],
      isError: true,
    });
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It explains conditional deletion behavior (single vs. all entries) but does not disclose irreversibility, auth requirements, or side effects.

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 wasted words. The first sentence front-loads the core purpose. Every sentence earns its place.

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

Completeness4/5

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

The description adequately covers the tool's conditional behavior given the parameters. No output schema, but the simple nature of deletion makes this acceptable. Could mention behavior when no entries exist, but not critical.

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

Parameters4/5

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

The input schema has 100% description coverage. The description adds meaning by explaining the conditional effect of the category parameter (single entry vs. all entries), which goes beyond the schema's basic descriptions.

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?

The description clearly states the tool deletes flow entries for a period, with a specific conditional: if category provided, only that entry; else all entries. This distinguishes it from sibling delete tools like delete_balance and delete_txn.

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?

The description implies usage for deleting flow entries but does not provide explicit guidance on when to use this tool versus alternatives or when not to use it. No exclusions or comparisons are given.

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/evan-moon/firma'

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