Skip to main content
Glama
klodr

mercury-invoicing-mcp

mercury_update_transaction

Tag a transaction with a category or attach an internal memo for bookkeeping. Clear fields by sending null.

Instructions

Update a transaction's internal note or category (no money movement).

USE WHEN: tagging a transaction with a category for bookkeeping, or attaching an internal memo. Send null to clear a field, omit the key to keep the current value.

DO NOT USE: to change the amount, counterparty, or status — those are immutable post-execution. Mercury endpoint is PATCH /transaction/{id} (no accountId in the path).

SIDE EFFECTS: overwrites the note / category on Mercury's side. Persistent. Audit log on Mercury records the change. No effect on the booked transaction itself or on the counterparty.

RETURNS: { id, note, categoryId, ... } — the updated transaction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
transactionIdYesThe transaction ID
noteNoInternal note (send null to clear, omit to keep current)
categoryIdNoCategory ID (UUID, see mercury_list_categories). Send null to clear, omit to keep current.

Implementation Reference

  • The core handler for mercury_update_transaction. Defines the tool with defineTool(), accepts transactionId (UUID), optional note (nullable string), and optional categoryId (nullable UUID). The handler makes a PATCH request to /transaction/{transactionId} with the provided body.
    defineTool(
      server,
      "mercury_update_transaction",
      [
        "Update a transaction's internal note or category (no money movement).",
        "",
        "USE WHEN: tagging a transaction with a category for bookkeeping, or attaching an internal memo. Send `null` to clear a field, omit the key to keep the current value.",
        "",
        "DO NOT USE: to change the amount, counterparty, or status — those are immutable post-execution. Mercury endpoint is `PATCH /transaction/{id}` (no `accountId` in the path).",
        "",
        "SIDE EFFECTS: overwrites the note / category on Mercury's side. Persistent. Audit log on Mercury records the change. No effect on the booked transaction itself or on the counterparty.",
        "",
        "RETURNS: `{ id, note, categoryId, ... }` — the updated transaction.",
      ].join("\n"),
      {
        transactionId: z.uuid().describe("The transaction ID"),
        note: z
          .string()
          .nullable()
          .optional()
          .describe("Internal note (send null to clear, omit to keep current)"),
        categoryId: z
          .uuid()
          .nullable()
          .optional()
          .describe(
            "Category ID (UUID, see mercury_list_categories). Send null to clear, omit to keep current.",
          ),
      },
      async ({ transactionId, ...body }) => {
        const data = await client.patch(`/transaction/${transactionId}`, body);
        return textResult(data);
      },
      { title: "Update Transaction", destructiveHint: false, openWorldHint: true },
    );
  • Input schema for mercury_update_transaction. Uses Zod validation: transactionId (z.uuid()), note (z.string().nullable().optional()), categoryId (z.uuid().nullable().optional()).
    {
      transactionId: z.uuid().describe("The transaction ID"),
      note: z
        .string()
        .nullable()
        .optional()
        .describe("Internal note (send null to clear, omit to keep current)"),
      categoryId: z
        .uuid()
        .nullable()
        .optional()
        .describe(
          "Category ID (UUID, see mercury_list_categories). Send null to clear, omit to keep current.",
        ),
    },
  • Registration entrypoint: registerAllTools() calls registerTransactionTools(server, client) which registers mercury_update_transaction on the MCP server.
    export function registerAllTools(server: McpServer, client: MercuryClient): void {
      // Banking
      registerAccountTools(server, client);
      registerCardTools(server, client);
      registerCreditTools(server, client);
      registerTransactionTools(server, client);
  • registerTransactionTools function definition — the function that registers mercury_update_transaction (and other transaction tools) on the MCP server.
    export function registerTransactionTools(server: McpServer, client: MercuryClient): void {
  • defineTool helper used by mercury_update_transaction. Calls wrapToolHandler() for rate limiting/dry-run/audit middleware, then registers the tool on the MCP server with strict schema validation.
    export function defineTool<S extends ZodRawShape>(
      server: McpServer,
      name: string,
      description: string,
      inputSchema: S,
      handler: (args: z.infer<z.ZodObject<S>>) => Promise<ToolResult>,
      annotations: ToolAnnotations,
    ): void {
      const wrapped = wrapToolHandler(name, handler);
      const strictSchema = z.object(inputSchema).strict();
      // MCP behavioral annotations (readOnlyHint / destructiveHint /
      // idempotentHint / openWorldHint) — declared machine-readable so
      // hosts and rubrics (TDQS / Glama Behavior dimension) can detect
      // tool semantics without scraping the prose description. Required
      // (not optional) so every new tool ships with explicit semantics —
      // forgetting the annotation now fails typecheck instead of
      // silently shipping a tool with no hint set.
      // The MCP SDK overloads `registerTool` with shape narrowing the runtime
      // strict-schema and the wrapped callback can't satisfy through generics.
      // Both casts are runtime-safe — the signatures only diverge at the type
      // level. Asserted by the existing tool-registration tests.
      (server.registerTool as unknown as (...a: unknown[]) => unknown)(
        name,
        { description, inputSchema: strictSchema, annotations },
        wrapped,
      );
    }
Behavior5/5

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

Goes beyond annotation (destructiveHint=false) by explaining the side effects: overwrites, persistent, audit log, no effect on booked transaction or counterparty. No contradiction with 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?

The description is concise, well-structured with clear sections (USE WHEN, DO NOT USE, SIDE EFFECTS, RETURNS), and contains no unnecessary words.

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

Completeness5/5

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

Despite no output schema, the description provides a return format and covers all aspects: purpose, usage, side effects, and parameter behavior. No gaps.

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?

Schema coverage is 100%, but the description adds value by explaining the 'null' vs 'omit' behavior for note and categoryId, and references mercury_list_categories for categoryId. This is helpful beyond the schema.

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 'Update', the resource 'transaction', and the specific fields ('internal note or category'). It also clarifies 'no money movement', distinguishing it from sibling tools like mercury_send_money.

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

Usage Guidelines5/5

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

Provides explicit 'USE WHEN' and 'DO NOT USE' scenarios, including what fields are immutable. Also mentions the API endpoint, giving clear context for when to use this tool.

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/klodr/mercury-invoicing-mcp'

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