Skip to main content
Glama

xero_payments_get

Retrieve complete details for a specific Xero payment using its unique identifier.

Instructions

Get detailed information about a specific payment by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paymentIdYesThe unique payment ID (UUID)

Implementation Reference

  • Schema/definition for the 'xero_payments_get' tool. Defines the tool name, description, and inputSchema requiring a 'paymentId' (UUID string).
    {
      name: "xero_payments_get",
      description:
        "Get detailed information about a specific payment by its ID.",
      inputSchema: {
        type: "object",
        properties: {
          paymentId: {
            type: "string",
            description: "The unique payment ID (UUID)",
          },
        },
        required: ["paymentId"],
      },
    },
  • Handler function for 'xero_payments_get'. Extracts paymentId from args, calls client.get('Payments/{paymentId}'), and returns the JSON response.
    case "xero_payments_get": {
      const { paymentId } = args as { paymentId: string };
      const response = await client.get(`Payments/${paymentId}`);
      return {
        content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
      };
    }
  • src/index.ts:177-198 (registration)
    Tools list registration: getAllDomainTools() collects paymentTools (which includes xero_payments_get) and registers them with the MCP server via ListToolsRequestSchema handler.
    function createMcpServer(): Server {
      const server = new Server(
        {
          name: "xero-mcp",
          version: "1.0.0",
        },
        {
          capabilities: {
            tools: {},
          },
        }
      );
    
      setServerRef(server);
    
      /**
       * Handle ListTools requests - always returns ALL tools
       */
      server.setRequestHandler(ListToolsRequestSchema, async () => {
        const domainTools = getAllDomainTools();
        return { tools: [navigateTool, statusTool, backTool, ...domainTools] };
      });
  • src/index.ts:260-263 (registration)
    Tool call routing: the CallToolRequestSchema handler routes 'xero_payments_' prefixed tool names to handlePaymentTool(), which contains the xero_payments_get case.
    }
    if (name.startsWith("xero_payments_")) {
      return await handlePaymentTool(name, toolArgs);
    }
  • XeroClient class used by the handler. The get() method (lines 83-85) makes authenticated GET requests to the Xero API, called by the xero_payments_get handler.
    class XeroClient {
      private config: XeroClientConfig;
    
      constructor(config: XeroClientConfig) {
        this.config = config;
      }
    
      /**
       * Make an authenticated request to the Xero API
       */
      private async request(
        method: string,
        path: string,
        params?: Record<string, string>,
        body?: unknown
      ): Promise<unknown> {
        let url = `${XERO_API_BASE}/${path}`;
        if (params && Object.keys(params).length > 0) {
          const searchParams = new URLSearchParams(params);
          url += `?${searchParams.toString()}`;
        }
    
        const headers: Record<string, string> = {
          Authorization: `Bearer ${this.config.accessToken}`,
          "xero-tenant-id": this.config.tenantId,
          "Content-Type": "application/json",
          Accept: "application/json",
        };
    
        const options: RequestInit = { method, headers };
        if (body !== undefined) {
          options.body = JSON.stringify(body);
        }
    
        const response = await fetch(url, options);
    
        if (!response.ok) {
          const responseBody = await response.text();
          throw new Error(
            `Xero API error ${method} /${path} (${response.status}): ${responseBody}`
          );
        }
    
        // Handle 204 No Content
        if (response.status === 204) {
          return null;
        }
    
        return response.json();
      }
    
      /**
       * GET request
       */
      async get(path: string, params?: Record<string, string>): Promise<unknown> {
        return this.request("GET", path, params);
      }
    
      /**
       * POST request
       */
      async post(path: string, body: unknown): Promise<unknown> {
        return this.request("POST", path, undefined, body);
      }
    
      /**
       * PUT request
       */
      async put(path: string, body: unknown): Promise<unknown> {
        return this.request("PUT", path, undefined, body);
      }
    
      /**
       * DELETE request
       */
      async delete(path: string): Promise<unknown> {
        return this.request("DELETE", path);
      }
    
      /**
       * Fetch all pages of a paginated endpoint.
       * Xero uses 1-based page numbers and returns 100 items per page.
       * Returns the combined items from all pages.
       */
      async getPaginated(
        path: string,
        params?: Record<string, string>,
        responseKey?: string
      ): Promise<unknown[]> {
        const allItems: unknown[] = [];
        let page = 1;
        let hasMore = true;
    
        while (hasMore) {
          const response = (await this.get(path, {
            ...params,
            page: String(page),
          })) as Record<string, unknown>;
    
          // Xero wraps responses in a key matching the resource name
          const items = responseKey
            ? (response[responseKey] as unknown[])
            : (Object.values(response).find((v) => Array.isArray(v)) as
                | unknown[]
                | undefined);
    
          if (items && items.length > 0) {
            allItems.push(...items);
            hasMore = items.length >= XERO_PAGE_SIZE;
            page++;
          } else {
            hasMore = false;
          }
        }
    
        return allItems;
      }
    }
Behavior3/5

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

No annotations provided, so the description carries the burden. It implies a read-only operation but does not explicitly state it is safe or idempotent. The description is minimal and adds little beyond the obvious.

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

Conciseness4/5

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

The description is a single sentence with no unnecessary words. However, it is slightly terse and could benefit from a bit more detail without losing conciseness.

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?

No output schema or annotations. The description is minimal and does not explain what 'detailed information' includes or any potential errors. Given the complexity of Xero, more context would be helpful.

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 description coverage is 100%, so baseline is 3. The description adds no additional meaning beyond the schema; it merely restates that the payment is identified by ID.

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 verb 'Get' and the resource 'payment by its ID'. It distinguishes from siblings like list (multiple) and create (create new). However, it could be more specific about what 'detailed information' includes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use vs alternatives like xero_payments_list or xero_payments_create. Usage is implied (when you need details of a single payment), but no when-not or context is provided.

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/wyre-technology/xero-mcp'

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