Skip to main content
Glama
klodr

mercury-invoicing-mcp

mercury_list_statements

Retrieve monthly statements for Mercury deposit accounts with downloadable PDF URLs for accounting export, audit, or sharing with a CPA.

Instructions

List monthly statements for a Mercury deposit account. Each statement has a downloadable PDF URL.

USE WHEN: fetching the URL of a past statement (e.g. for accounting export, audit, or sharing with a CPA). The PDF URL is short-lived — re-fetch it shortly before download.

DO NOT USE: for IO Credit account statements (Mercury exposes them only via the dashboard, not the API). For Treasury statements use mercury_list_treasury_statements.

RETURNS: { statements: [{ id, periodStart, periodEnd, downloadUrl, ... }] }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesThe Mercury account ID
startNoFilter statements from this date (YYYY-MM-DD)
endNoFilter statements to this date (YYYY-MM-DD)

Implementation Reference

  • The async handler function for mercury_list_statements. It calls client.get with the account ID and optional query params (start/end) and returns the result via textResult.
    async ({ accountId, ...query }) => {
      const data = await client.get(`/account/${accountId}/statements`, query);
      return textResult(data);
    },
  • Input schema for mercury_list_statements: accountId (required UUID), start (optional ISO date), end (optional ISO date).
    {
      accountId: z.string().uuid().describe("The Mercury account ID"),
      start: z.iso.date().optional().describe("Filter statements from this date (YYYY-MM-DD)"),
      end: z.iso.date().optional().describe("Filter statements to this date (YYYY-MM-DD)"),
  • Registration of mercury_list_statements via defineTool in registerStatementTools, called from src/tools/index.ts registerAllTools.
    export function registerStatementTools(server: McpServer, client: MercuryClient): void {
      defineTool(
        server,
        "mercury_list_statements",
        [
          "List monthly statements for a Mercury deposit account. Each statement has a downloadable PDF URL.",
          "",
          "USE WHEN: fetching the URL of a past statement (e.g. for accounting export, audit, or sharing with a CPA). The PDF URL is short-lived — re-fetch it shortly before download.",
          "",
          "DO NOT USE: for IO Credit account statements (Mercury exposes them only via the dashboard, not the API). For Treasury statements use `mercury_list_treasury_statements`.",
          "",
          "RETURNS: `{ statements: [{ id, periodStart, periodEnd, downloadUrl, ... }] }`.",
        ].join("\n"),
        {
          accountId: z.string().uuid().describe("The Mercury account ID"),
          start: z.iso.date().optional().describe("Filter statements from this date (YYYY-MM-DD)"),
          end: z.iso.date().optional().describe("Filter statements to this date (YYYY-MM-DD)"),
        },
        async ({ accountId, ...query }) => {
          const data = await client.get(`/account/${accountId}/statements`, query);
          return textResult(data);
        },
      );
  • defineTool helper that wraps the handler with middleware and registers the tool on the McpServer via 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);
    }
  • textResult helper used by the handler to format the API response into a ToolResult with sanitized JSON.
    export function textResult(data: unknown): ToolResult {
      // Walk the payload once, reuse the sanitized value for both the
      // LLM-display JSON string and the `structuredContent` object.
      // Calling sanitizeJsonForLlm(data) + sanitizeJsonValues(data)
      // separately would run the walker twice on the same input.
      const sanitized = sanitizeJsonValues(data);
      return {
        content: [{ type: "text", text: JSON.stringify(sanitized, null, 2) }],
        structuredContent: (sanitized ?? {}) as Record<string, unknown>,
      };
    }
Behavior4/5

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

No annotations provided, but description explains the PDF URL is short-lived and advises re-fetching. Also outlines return format. Does not explicitly state read-only nature, but it's implied. Slight gap on side effects or rate limits.

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?

Very concise with bullet points for use cases and return format. Every sentence adds value; no redundancy. Front-loaded with core purpose.

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 no output schema, description provides a return format snippet. Covers key aspects but lacks mention of pagination or ordering. Adequate for typical use.

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?

Schema coverage is 100%, so baseline 3. Description does not add extra meaning beyond schema for parameters; the date parameters are not re-explained. No compensation needed.

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 it lists Mercury deposit account statements with downloadable PDF URLs. It explicitly distinguishes from IO Credit and Treasury statements, and names the alternative tool for Treasury statements.

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' sections, specifying when to fetch statement URLs and when to avoid (IO Credit, Treasury). Names alternative tool for Treasury.

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