Skip to main content
Glama

get_invoice_payments_by_invoice_id

Read-onlyIdempotent

Retrieve all payment records associated with a given invoice ID. Supports pagination with cursor and per_page parameters.

Instructions

Get all payment records of an invoice

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoice_idYesID of the parent resource
cursorNoCursor for fetching the next page of results
per_pageNoNumber of results per page (default: 25)

Implementation Reference

  • The handler function for the 'get_invoice_payments_by_invoice_id' tool. It calls apiList with path `/invoices/${invoice_id}/payments`, logs the response, formats the results with pagination cursor support, and returns them.
    async ({ invoice_id, cursor, per_page }) => {
      try {
        const result = await apiList<EduframeRecord>(`/invoices/${invoice_id}/payments`, { cursor, per_page });
        void logResponse("get_invoice_payments_by_invoice_id", { invoice_id, cursor, per_page }, result);
        const toolResult = formatList(result.records, "payments");
        if (result.nextCursor) {
          toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
        }
        return toolResult;
      } catch (error) {
        return formatError(error);
      }
    },
  • Input schema for the tool: requires invoice_id (positive int), optional cursor (string), and optional per_page (positive int).
    inputSchema: {
      invoice_id: z.number().int().positive().describe("ID of the parent resource"),
      cursor: z.string().optional().describe("Cursor for fetching the next page of results"),
      per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"),
    },
  • Registration of the tool via server.registerTool() with name 'get_invoice_payments_by_invoice_id', description, annotations, input schema, and handler. The registerPaymentTools function is exported and called from src/tools/index.ts.
    export function registerPaymentTools(server: McpServer): void {
      server.registerTool(
        "get_invoice_payments_by_invoice_id",
        {
          description: "Get all payment records of an invoice",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            invoice_id: z.number().int().positive().describe("ID of the parent resource"),
            cursor: z.string().optional().describe("Cursor for fetching the next page of results"),
            per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"),
          },
        },
        async ({ invoice_id, cursor, per_page }) => {
          try {
            const result = await apiList<EduframeRecord>(`/invoices/${invoice_id}/payments`, { cursor, per_page });
            void logResponse("get_invoice_payments_by_invoice_id", { invoice_id, cursor, per_page }, result);
            const toolResult = formatList(result.records, "payments");
            if (result.nextCursor) {
              toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
            }
            return toolResult;
          } catch (error) {
            return formatError(error);
          }
        },
      );
  • The registerPaymentTools function is included in the tools array in src/tools/index.ts, which is iterated by registerAllTools() to register all tools with the server.
    registerPaymentTools,
  • The apiList helper function used by the handler to perform a GET request to a paginated list endpoint and return records with a nextCursor.
    export async function apiList<T>(path: string, query?: Record<string, QueryValue>): Promise<ListResult<T>> {
      const { token } = getConfig();
      const url = buildUrl(path, query);
    
      const response = await fetch(url.toString(), {
        method: "GET",
        headers: buildHeaders(token),
      });
    
      await checkResponse(response);
    
      const records = (await response.json()) as T[];
      const nextCursor = parseNextCursor(response.headers.get("Link"));
    
      return { records, nextCursor };
    }
Behavior3/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description adds no further behavioral traits such as pagination behavior or response structure. With annotations doing most of the work, the description is adequate but offers no extra value.

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 a single concise sentence that front-loads the purpose. No unnecessary words or repetition. It earns its place.

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

Completeness3/5

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

Given the tool is a simple list getter with pagination, the description is minimally acceptable. However, it lacks mention of pagination, return value structure, or dependencies (e.g., invoice existence). An output schema would have helped, but none exists. The description could be more informative.

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 input schema has 100% description coverage for all three parameters, so the schema already explains their meaning. The description adds no additional parameter context beyond what is in the schema. Baseline 3 applies.

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?

Description states 'Get all payment records of an invoice', clearly identifying the verb and resource, and distinguishing from sibling tools like create/delete. However, it does not mention pagination, which is indicated by the cursor and per_page parameters.

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 is provided on when to use this tool versus alternatives (e.g., get_payment for a single payment). The description lacks context about prerequisites or when not to use it.

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/martijnpieters/eduframe-mcp'

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