Skip to main content
Glama

edit_txn

Update a transaction's details by ID. Only supplied fields are changed, leaving others intact.

Instructions

Update fields of an existing transaction by id. Only provided fields are changed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
tickerNo
dateNoYYYY-MM-DD
typeNo
sharesNo
priceNo
reasonNoWhy this trade? (free-form)

Implementation Reference

  • Handler function that updates transaction fields by id. Only provided fields are changed. Returns updated transaction or error if not found.
    async ({ id, ticker, ...rest }) => {
      const db = getDb();
      const fields = {
        ...(ticker !== undefined ? { ticker: ticker.toUpperCase() } : {}),
        ...rest,
      };
      if (Object.keys(fields).length === 0) return err('No fields to update');
      const res = db.update(transactions).set(fields).where(eq(transactions.id, id)).run();
      if (res.changes === 0) return err(`Transaction #${id} not found`);
      const updated = db.select().from(transactions).where(eq(transactions.id, id)).get();
      return ok(updated);
    },
  • Zod schema defining input parameters: id (required positive int), ticker/date/type/shares/price/reason (all optional).
    {
      id: z.number().int().positive(),
      ticker: z.string().optional(),
      date: z.string().optional().describe('YYYY-MM-DD'),
      type: z.enum(['buy', 'sell', 'deposit', 'dividend', 'tax']).optional(),
      shares: z.number().positive().optional(),
      price: z.number().min(0).optional(),
      reason: z.string().nullable().optional().describe('Why this trade? (free-form)'),
    },
  • Tool registration via server.tool() inside registerMutateTools, called from apps/mcp/src/index.ts:21.
    server.tool(
      'edit_txn',
      'Update fields of an existing transaction by id. Only provided fields are changed.',
      {
        id: z.number().int().positive(),
        ticker: z.string().optional(),
        date: z.string().optional().describe('YYYY-MM-DD'),
        type: z.enum(['buy', 'sell', 'deposit', 'dividend', 'tax']).optional(),
        shares: z.number().positive().optional(),
        price: z.number().min(0).optional(),
        reason: z.string().nullable().optional().describe('Why this trade? (free-form)'),
      },
      async ({ id, ticker, ...rest }) => {
        const db = getDb();
        const fields = {
          ...(ticker !== undefined ? { ticker: ticker.toUpperCase() } : {}),
          ...rest,
        };
        if (Object.keys(fields).length === 0) return err('No fields to update');
        const res = db.update(transactions).set(fields).where(eq(transactions.id, id)).run();
        if (res.changes === 0) return err(`Transaction #${id} not found`);
        const updated = db.select().from(transactions).where(eq(transactions.id, id)).get();
        return ok(updated);
      },
    );
  • Helper function returning a success response with JSON content.
    export const ok = (data: unknown) => ({
      content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
    });
  • Helper function returning an error response with isError flag.
    export const err = (msg: string) => ({
      content: [{ type: 'text' as const, text: `Error: ${msg}` }],
      isError: true,
    });
Behavior2/5

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

With no annotations, description must fully disclose behavior. It only states partial update behavior, but omits important details like idempotency, error handling (e.g., missing id), and return value.

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 fluff. Front-loaded with verb and resource, then clarifies partial update. Every word is necessary.

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

Completeness2/5

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

For a tool with 7 parameters and no output schema or annotations, the description is too sparse. Missing input constraints, expected output, and usage context.

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

Parameters2/5

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

Schema coverage is low (29%) but description adds no parameter explanations beyond 'update fields by id.' The description does not compensate for undocumented parameters (ticker, type, shares, price, etc.).

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 'Update fields of an existing transaction by id.' This identifies the verb (update), resource (transaction), and key identifier. It also adds partial update semantics with 'Only provided fields are changed,' distinguishing it from create/new tools like add_txn.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives (e.g., add_txn for creation, delete_txn for removal). No mention of prerequisites or context.

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