Skip to main content
Glama
klodr

mercury-invoicing-mcp

mercury_list_treasury_statements

Read-only

Retrieve monthly Treasury account statements and their download URLs for tax or audit export. Use with a specific account ID to get statement periods and short-lived PDF links.

Instructions

List monthly statements for a Mercury Treasury account.

USE WHEN: fetching the URL of a past Treasury statement for tax/audit export. PDF URL is short-lived — fetch it shortly before download.

DO NOT USE: for deposit-account statements (use mercury_list_statements). IO Credit statements are not exposed via the API.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesTreasury account ID

Implementation Reference

  • The handler function for 'mercury_list_treasury_statements'. It accepts accountId (a UUID), calls GET /treasury/{accountId}/statements via MercuryClient, and returns the result as a text response.
    defineTool(
      server,
      "mercury_list_treasury_statements",
      [
        "List monthly statements for a Mercury Treasury account.",
        "",
        "USE WHEN: fetching the URL of a past Treasury statement for tax/audit export. PDF URL is short-lived — fetch it shortly before download.",
        "",
        "DO NOT USE: for deposit-account statements (use `mercury_list_statements`). IO Credit statements are not exposed via the API.",
        "",
        "RETURNS: `{ statements: [{ id, periodStart, periodEnd, downloadUrl, ... }] }`.",
      ].join("\n"),
      {
        accountId: z.uuid().describe("Treasury account ID"),
      },
      async ({ accountId }) => {
        const data = await client.get(`/treasury/${accountId}/statements`);
        return textResult(data);
      },
  • Input schema for the tool: a single required 'accountId' field validated as a UUID.
    {
      accountId: z.uuid().describe("Treasury account ID"),
  • The tool is registered via defineTool() called inside registerTreasuryTools(), which is invoked from registerAllTools() in src/tools/index.ts (line 28), which is called from createServer() in src/server.ts (line 193).
      defineTool(
        server,
        "mercury_list_treasury_statements",
        [
          "List monthly statements for a Mercury Treasury account.",
          "",
          "USE WHEN: fetching the URL of a past Treasury statement for tax/audit export. PDF URL is short-lived — fetch it shortly before download.",
          "",
          "DO NOT USE: for deposit-account statements (use `mercury_list_statements`). IO Credit statements are not exposed via the API.",
          "",
          "RETURNS: `{ statements: [{ id, periodStart, periodEnd, downloadUrl, ... }] }`.",
        ].join("\n"),
        {
          accountId: z.uuid().describe("Treasury account ID"),
        },
        async ({ accountId }) => {
          const data = await client.get(`/treasury/${accountId}/statements`);
          return textResult(data);
        },
        { title: "List Treasury Statements", readOnlyHint: true, openWorldHint: true },
      );
    }
  • defineTool() is the generic registration helper that wraps the handler with middleware (wrapToolHandler) and registers it on the MCP server with schema and annotations.
    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,
      );
    }
  • registerTreasuryTools() is called from registerAllTools() in the tools index, connecting the treasury module (including mercury_list_treasury_statements) to the server.
    registerStatementTools(server, client);
    registerTreasuryTools(server, client);
Behavior5/5

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

Beyond the annotations (readOnlyHint, openWorldHint), the description discloses a critical behavioral trait: the PDF URL is short-lived and should be fetched shortly before download. This adds valuable context that annotations alone do not capture.

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 extremely concise: three short paragraphs covering purpose, usage guidelines, and return structure. No filler or redundant information; every sentence earns its place.

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 the single parameter, no output schema, and annotations, the description fully addresses purpose, when to use, return shape (listing fields), and a temporal constraint. It also explicitly discriminates from sibling tools, making the description complete for the tool's complexity.

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 schema already covers the single parameter 'accountId' with a description ('Treasury account ID') and 100% coverage. The description does not add further parameter-level detail, so the baseline of 3 is appropriate.

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 'List monthly statements for a Mercury Treasury account.' It uses a specific verb ('list') and resource ('monthly statements'), and ties to a specific entity ('Mercury Treasury account'). It effectively distinguishes from the sibling tool 'mercury_list_statements' by contrasting deposit vs. treasury accounts.

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?

The description explicitly provides 'USE WHEN' (fetching URL for tax/audit export) and 'DO NOT USE' (deposit-account statements, IO Credit statements not exposed). It names the alternative tool 'mercury_list_statements' for deposit accounts, giving clear context for when to choose this tool over its sibling.

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