Skip to main content
Glama
klodr

mercury-invoicing-mcp

mercury_get_transaction

Retrieve full details of a single transaction by ID for a Mercury deposit account. Use when you already know the transaction ID to get complete data without relisting and filtering.

Instructions

Retrieve a specific transaction by ID for a Mercury deposit account.

USE WHEN: fetching the full detail of one transaction whose ID is already known (typically from mercury_list_transactions). Faster than relisting + filtering.

DO NOT USE: to enumerate transactions (use mercury_list_transactions). For IO Credit transactions, use mercury_list_credit_transactions and filter by id client-side.

RETURNS: { id, amount, status, postedAt, counterpartyName, memo, ... }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesThe Mercury account ID
transactionIdYesThe transaction ID

Implementation Reference

  • The async handler function that executes the tool logic. It calls client.get() with the account ID and transaction ID to retrieve a specific transaction from the Mercury API, then returns the result via textResult().
    async ({ accountId, transactionId }) => {
      const data = await client.get(`/account/${accountId}/transaction/${transactionId}`);
      return textResult(data);
    },
  • Input schema/validation for the tool. Defines two required parameters: accountId (UUID) and transactionId (UUID), both described with Zod validators.
    {
      accountId: z.string().uuid().describe("The Mercury account ID"),
      transactionId: z.string().uuid().describe("The transaction ID"),
    },
  • Registration of the tool via defineTool() — binds the name 'mercury_get_transaction', its description, input schema, and handler to the MCP server.
    defineTool(
      server,
      "mercury_get_transaction",
      [
        "Retrieve a specific transaction by ID for a Mercury deposit account.",
        "",
        "USE WHEN: fetching the full detail of one transaction whose ID is already known (typically from `mercury_list_transactions`). Faster than relisting + filtering.",
        "",
        "DO NOT USE: to enumerate transactions (use `mercury_list_transactions`). For IO Credit transactions, use `mercury_list_credit_transactions` and filter by id client-side.",
        "",
        "RETURNS: `{ id, amount, status, postedAt, counterpartyName, memo, ... }`.",
      ].join("\n"),
      {
        accountId: z.string().uuid().describe("The Mercury account ID"),
        transactionId: z.string().uuid().describe("The transaction ID"),
      },
      async ({ accountId, transactionId }) => {
        const data = await client.get(`/account/${accountId}/transaction/${transactionId}`);
        return textResult(data);
      },
    );
  • The parent function registerTransactionTools() which registers all transaction tools including mercury_get_transaction on the MCP server.
    export function registerTransactionTools(server: McpServer, client: MercuryClient): void {
      defineTool(
        server,
        "mercury_list_transactions",
        [
          "List transactions for a Mercury deposit account, with optional filters (date range, status, search).",
          "",
          "USE WHEN: auditing deposit-account activity, reconciling a statement, or building a per-account ledger view. Filters server-side: `status`, `start`, `end`, `search`, `limit`, `offset`.",
          "",
          "DO NOT USE: for IO Credit transactions (use `mercury_list_credit_transactions`, which targets the IO Credit account surface). For Treasury, use `mercury_list_treasury_transactions`.",
          "",
          "RETURNS: `{ transactions: [{ id, amount, status, postedAt, counterpartyName, ... }] }`.",
        ].join("\n"),
        {
          accountId: z.string().uuid().describe("The Mercury account ID"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(500)
            .optional()
            .describe("Max results to return (1-500). Default: 500"),
          offset: z.number().int().min(0).optional().describe("Pagination offset"),
          status: z
            .enum(["pending", "sent", "cancelled", "failed"])
            .optional()
            .describe("Filter by transaction status"),
          start: z.iso.date().optional().describe("Filter posted on/after this date (YYYY-MM-DD)"),
          end: z.iso.date().optional().describe("Filter posted on/before this date (YYYY-MM-DD)"),
          search: z.string().optional().describe("Search query (counterparty name, memo, etc.)"),
        },
        async ({ accountId, ...query }) => {
  • The defineTool helper function used to register each tool. It wraps the handler with middleware and calls server.registerTool().
    export function defineTool<S extends ZodRawShape>(
      server: McpServer,
      name: string,
      description: string,
      inputSchema: S,
      handler: (args: z.infer<z.ZodObject<S>>) => Promise<ToolResult>,
    ): void {
      const wrapped = wrapToolHandler(name, handler);
      const strictSchema = z.object(inputSchema).strict();
      server.registerTool(name, { description, inputSchema: strictSchema }, wrapped);
    }
Behavior4/5

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

No annotations provided, but description clearly implies read-only behavior ('Retrieve') and gives a partial return shape (`{ id, amount, status, ... }`). It does not mention potential errors or rate limits, but the core behavior is well communicated.

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?

Extremely concise (4 sentences) with clear sections (USE WHEN, DO NOT USE, RETURNS). Every sentence adds value with no redundancy.

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?

Given no output schema, description provides a useful sketch of return fields. Parameter semantics are fully documented in the schema. Usage guidelines are comprehensive, making the tool's role clear among many siblings.

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?

Input schema covers 100% of parameters with descriptions. The description does not add parameter-specific syntax but reinforces the context (e.g., 'typically from mercury_list_transactions'). Baseline 3 applies as schema does the heavy lifting.

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 uses clear verb 'Retrieve' and specific resource 'a specific transaction by ID for a Mercury deposit account'. It immediately distinguishes from sibling `mercury_list_transactions` by indicating it is for a single known transaction.

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?

Explicitly states when to use (fetching full detail of already-known transaction) and when not to use (enumerating transactions, IO Credit transactions), with direct references to sibling tools (`mercury_list_transactions`, `mercury_list_credit_transactions`).

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