Skip to main content
Glama

delete_snapshot

Remove all portfolio snapshot records for a specific date. Use this to delete an incorrect or unwanted snapshot from the asset tracker.

Instructions

Delete all portfolio snapshot rows for a given date (YYYY-MM-DD). Use only when the user explicitly asks to remove a bad snapshot — destructive.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYesSnapshot date (YYYY-MM-DD)

Implementation Reference

  • The handler/execution logic for the 'delete_snapshot' tool. It accepts a date string, deletes all portfolio snapshot rows for that date from the database using drizzle-orm, and returns the count of deleted rows.
    server.tool(
      'delete_snapshot',
      'Delete all portfolio snapshot rows for a given date (YYYY-MM-DD). Use only when the user explicitly asks to remove a bad snapshot — destructive.',
      { date: z.string().describe('Snapshot date (YYYY-MM-DD)') },
      async ({ date }) => {
        const db = getDb();
        const res = db.delete(portfolioSnapshots).where(eq(portfolioSnapshots.date, date)).run();
        if (res.changes === 0) return err(`No snapshot found for ${date}`);
        return ok({ deleted: res.changes, date });
      },
    );
  • Input schema for delete_snapshot: requires a single 'date' string parameter (YYYY-MM-DD format), validated with Zod.
    'Delete all portfolio snapshot rows for a given date (YYYY-MM-DD). Use only when the user explicitly asks to remove a bad snapshot — destructive.',
    { date: z.string().describe('Snapshot date (YYYY-MM-DD)') },
  • Registration of the registerSnapshotTools function which registers all snapshot tools including delete_snapshot on the MCP server.
    registerSnapshotTools(server);
  • The registerSnapshotTools function that registers delete_snapshot (along with other snapshot tools) on the McpServer via server.tool().
    export function registerSnapshotTools(server: McpServer): void {
  • The CLI-side deleteSnapshotCommand (separate from the MCP tool) which provides an interactive prompt for deleting a snapshot. Not the MCP tool implementation but a related command-line version.
    export const deleteSnapshotCommand = async (dateArg?: string) => {
      const repo = getRepository();
      const dates = repo.snapshots.getDates();
    
      if (dates.length === 0) {
        log.warn('No snapshots to delete.');
        return;
      }
    
      let date: string;
      if (dateArg) {
        if (!/^\d{4}-\d{2}-\d{2}$/.test(dateArg)) {
          log.error(`Invalid date "${dateArg}". Use YYYY-MM-DD format.`);
          process.exit(1);
        }
        if (!dates.includes(dateArg)) {
          log.error(`No snapshot for ${dateArg}.`);
          process.exit(1);
        }
        date = dateArg;
      } else {
        date = guard(
          await select({
            message: 'Select snapshot date to delete',
            options: dates.map((d) => ({ value: d, label: d })),
          }),
        ) as string;
      }
    
      const entries = repo.snapshots.getByDate(date);
      const totalMV = entries.reduce((s, e) => s + e.current_price * e.shares, 0);
    
      log.message(
        [
          `${pc.dim('Date:')}     ${date}`,
          `${pc.dim('Holdings:')} ${entries.length}`,
          `${pc.dim('Total MV:')} $${totalMV.toFixed(2)}`,
        ].join('\n'),
      );
    
      const ok = guard(
        await confirm({
          message: `Delete all ${entries.length} snapshot entries for ${date}?`,
          initialValue: false,
        }),
      ) as boolean;
      if (!ok) {
        cancel('Cancelled');
        return;
      }
    
      const deleted = repo.snapshots.deleteByDate(date);
      log.success(`Deleted ${deleted} snapshot entr${deleted === 1 ? 'y' : 'ies'} for ${date}.`);
    };
Behavior3/5

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

The description labels the tool as 'destructive' and indicates it deletes all rows for a date, which are key behavioral traits. However, with no annotations provided, the description carries the full burden of disclosure; it lacks details on irreversibility, side effects, or prerequisites.

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?

The description is a single, well-structured sentence that is front-loaded with the core action. Every word contributes value, with no redundancy or extraneous information.

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?

Given the tool's simplicity (one parameter, no output schema, no annotations), the description covers the essential aspects: action, resource, date format, and usage context. It could further benefit from stating that the operation is irreversible or requires confirmation, but the destructive warning partially compensates.

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?

The single parameter 'date' is fully described in the input schema with format (YYYY-MM-DD). The description repeats this format but does not add new semantic meaning beyond what the schema already provides. Schema coverage is 100%, justifying a baseline score of 3.

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 verb 'Delete' and the resource 'all portfolio snapshot rows for a given date', specifying the date format. It uniquely identifies the tool's purpose among siblings like delete_balance, delete_flow, 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 Guidelines4/5

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

The description explicitly advises to 'Use only when the user explicitly asks to remove a bad snapshot — destructive.' This provides clear contextual guidance on when to invoke the tool and warns of destructive behavior, though it does not mention specific alternatives.

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