Skip to main content
Glama
europarcel
by europarcel

Get Payout Reports

getPayoutReports

Retrieve consolidated bank transfer payout reports. Paginate through results using the page parameter.

Instructions

Retrieves payout reports showing consolidated bank transfer information. Parameters: page (number)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination (1-1000, default: 1)

Implementation Reference

  • The tool handler function 'registerGetPayoutReportsTool' that registers and implements the 'getPayoutReports' tool. It accepts an optional 'page' parameter, calls the API client, formats payout reports grouped by status (paid, processing, pending, failed, cancelled), and returns a formatted text response.
    export function registerGetPayoutReportsTool(server: McpServer): void {
      // Create API client instance
    
      // Register getPayoutReports tool
      server.registerTool(
        "getPayoutReports",
        {
          title: "Get Payout Reports",
          description:
            "Retrieves payout reports showing consolidated bank transfer information. Parameters: page (number)",
          inputSchema: {
            page: z
              .number()
              .int()
              .min(1)
              .max(1000)
              .optional()
              .describe("Page number for pagination (1-1000, default: 1)"),
          },
        },
        async (args: any) => {
          // Get API key from async context
          const apiKey = apiKeyStorage.getStore();
    
          if (!apiKey) {
            return {
              content: [
                {
                  type: "text",
                  text: "Error: X-API-KEY header is required",
                },
              ],
            };
          }
    
          // Create API client with customer's API key
          const client = new EuroparcelApiClient(apiKey);
    
          try {
            logger.info("Fetching payout reports", args);
    
            const response = await client.getPayoutReports({
              page: args.page,
            });
    
            logger.info(`Retrieved ${response.list.length} payout reports`);
    
            let formattedResponse = `Found ${response.pagination.total} total payout reports\n`;
            formattedResponse += `Page ${response.pagination.current_page} of ${response.pagination.last_page}\n\n`;
    
            if (response.list.length === 0) {
              formattedResponse += "No payout reports found.";
            } else {
              // Group by status
              const grouped = response.list.reduce(
                (acc: Record<string, PayoutReport[]>, report) => {
                  if (!acc[report.status]) {
                    acc[report.status] = [];
                  }
                  acc[report.status].push(report);
                  return acc;
                },
                {},
              );
    
              // Display in order: paid, processing, pending, failed, cancelled
              const statusOrder = [
                "paid",
                "processing",
                "pending",
                "failed",
                "cancelled",
              ];
    
              statusOrder.forEach((status) => {
                if (grouped[status] && grouped[status].length > 0) {
                  formattedResponse += `\n${formatStatus(status).toUpperCase()} (${grouped[status].length})\n`;
                  formattedResponse += "─".repeat(50) + "\n";
    
                  grouped[status].forEach((report: PayoutReport) => {
                    formattedResponse += `\nšŸ’° Payout #${report.payout_id}\n`;
                    formattedResponse += `   Amount: ${formatAmount(report.repayment_amount, report.repayment_currency)}\n`;
    
                    if (report.bank_holder && report.bank_iban) {
                      formattedResponse += `   Bank Account: ${report.bank_holder}\n`;
                      formattedResponse += `   IBAN: ${report.bank_iban}\n`;
                    }
    
                    if (report.paid_at) {
                      formattedResponse += `   Paid At: ${report.paid_at}\n`;
                    }
                  });
                }
              });
    
              // Add summary
              formattedResponse += "\n\nšŸ“Š SUMMARY:\n";
              const totalAmount = response.list.reduce(
                (sum, report) => sum + report.repayment_amount,
                0,
              );
              const currency = response.list[0]?.repayment_currency || "RON";
              formattedResponse += `Total Amount: ${formatAmount(totalAmount, currency)}\n`;
    
              Object.entries(grouped).forEach(([status, reports]) => {
                const statusTotal = reports.reduce(
                  (sum, report) => sum + report.repayment_amount,
                  0,
                );
                formattedResponse += `${formatStatus(status)}: ${reports.length} reports (${formatAmount(statusTotal, currency)})\n`;
              });
    
              // Add pagination info if there are more pages
              if (response.pagination.last_page > 1) {
                formattedResponse += `\nShowing page ${response.pagination.current_page} of ${response.pagination.last_page}`;
                if (
                  response.pagination.current_page < response.pagination.last_page
                ) {
                  formattedResponse += `\nUse page: ${response.pagination.current_page + 1} to see more`;
                }
              }
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: formattedResponse,
                },
              ],
            };
          } catch (error: any) {
            logger.error("Failed to fetch payout reports", error);
    
            return {
              content: [
                {
                  type: "text",
                  text: `Error fetching payout reports: ${error.message || "Unknown error"}`,
                },
              ],
            };
          }
        },
      );
    
      logger.info("getPayoutReports tool registered successfully");
    }
  • Input schema definition for the getPayoutReports tool: title 'Get Payout Reports', description, and a single optional integer parameter 'page' (1-1000) for pagination.
    "getPayoutReports",
    {
      title: "Get Payout Reports",
      description:
        "Retrieves payout reports showing consolidated bank transfer information. Parameters: page (number)",
      inputSchema: {
        page: z
          .number()
          .int()
          .min(1)
          .max(1000)
          .optional()
          .describe("Page number for pagination (1-1000, default: 1)"),
      },
    },
  • Import of registerGetPayoutReportsTool from the getPayoutReports module within the repayment tools index.
    import { registerGetPayoutReportsTool } from "./getPayoutReports.js";
  • Registration call: registerGetPayoutReportsTool(server) called in registerRepaymentTools to wire up the tool.
    registerGetPayoutReportsTool(server);
  • API client method 'getPayoutReports' that makes the HTTP GET request to '/repayments/reports' with optional page parameter and returns PayoutReportListResponse.
    async getPayoutReports(params?: {
      page?: number;
    }): Promise<PayoutReportListResponse> {
      const response = await this.client.get<PayoutReportListResponse>(
        "/repayments/reports",
        {
          params,
        },
      );
      return response.data;
    }
Behavior2/5

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

With no annotations, the description carries full burden for behavioral disclosure. It mentions pagination via 'page' parameter but does not state read-only nature, rate limits, or other behaviors beyond retrieval.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very short (one sentence). It is appropriately sized for a simple tool but lacks essential information such as pagination behavior or response details, sacrificing completeness for brevity.

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?

Given the single parameter, no output schema, and no annotations, the description is incomplete. It does not specify what the response contains or how pagination interacts with the data, requiring agent inference.

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?

The input schema already describes the 'page' parameter completely (100% coverage). The description redundantly lists the parameter without adding meaning, such as default value or relationship to data.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves payout reports with consolidated bank transfer information. It uses a specific verb and noun, but does not differentiate from sibling tools like 'getRepayments'.

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. The description lacks context about prerequisites or exclusion criteria, leaving the agent to infer usage.

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/europarcel/mcp-docker'

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