Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

list-items

Retrieve item codes and descriptions from Xero to populate invoices accurately. Use this tool to access product or service details for billing purposes.

Instructions

Lists all items in Xero. Use this tool to get the item codes and descriptions to be used when creating invoices in Xero

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageYes

Implementation Reference

  • The execution handler for the 'list-items' MCP tool. It calls the listXeroItems helper, handles errors, and formats the items list into MCP text content blocks.
    async ({ page }) => {
      const response = await listXeroItems(page);
    
      if (response.isError) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error listing items: ${response.error}`,
            },
          ],
        };
      }
    
      const items = response.result;
    
      return {
        content: [
          {
            type: "text" as const,
            text: `Found ${items?.length || 0} items:`,
          },
          ...(items?.map((item) => ({
            type: "text" as const,
            text: [
              `Item: ${item.name || "Unnamed"}`,
              `ID: ${item.itemID}`,
              `Code: ${item.code}`,
              item.description ? `Description: ${item.description}` : null,
              item.purchaseDescription ? `Purchase Description: ${item.purchaseDescription}` : null,
              item.salesDetails?.unitPrice !== undefined ? `Sales Price: ${item.salesDetails.unitPrice}` : null,
              item.purchaseDetails?.unitPrice !== undefined ? `Purchase Price: ${item.purchaseDetails.unitPrice}` : null,
              item.salesDetails?.accountCode ? `Sales Account: ${item.salesDetails.accountCode}` : null,
              item.purchaseDetails?.accountCode ? `Purchase Account: ${item.purchaseDetails.accountCode}` : null,
              item.isTrackedAsInventory !== undefined ? `Tracked as Inventory: ${item.isTrackedAsInventory ? 'Yes' : 'No'}` : null,
              item.isSold !== undefined ? `Is Sold: ${item.isSold ? 'Yes' : 'No'}` : null,
              item.isPurchased !== undefined ? `Is Purchased: ${item.isPurchased ? 'Yes' : 'No'}` : null,
              item.updatedDateUTC ? `Last Updated: ${item.updatedDateUTC}` : null,
              item.validationErrors?.length ? `Validation Errors: ${item.validationErrors.map(e => e.message).join(", ")}` : null,
            ]
              .filter(Boolean)
              .join("\n"),
          })) || []),
        ],
      };
    },
  • Input schema for the 'list-items' tool: optional page number (defaults to 1).
    {
      page: z.number(),
    },
  • Top-level registration of the 'list-items' tool (as part of ListTools) on the MCP server using server.tool().
    ListTools.map((tool) => tool()).forEach((tool) =>
      server.tool(tool.name, tool.description, tool.schema, tool.handler),
    );
  • Includes ListItemsTool in the ListTools array exported for registration.
    ListItemsTool,
  • Core helper function that fetches items from Xero API using xeroClient.accountingApi.getItems and wraps in standard response format.
    export async function listXeroItems(
      page: number = 1,
    ): Promise<XeroClientResponse<Item[]>> {
      try {
        const items = await getItems(page);
    
        return {
          result: items,
          isError: false,
          error: null,
        };
      } catch (error) {
        return {
          result: null,
          isError: true,
          error: formatError(error),
        };
      }
    } 
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the tool lists items but doesn't disclose behavioral traits like pagination behavior (implied by the 'page' parameter), rate limits, authentication needs, or what the output looks like. For a list operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 appropriately sized with two sentences that are front-loaded and efficient. The first sentence states the purpose, and the second adds usage context without unnecessary details, making it easy to parse.

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 complexity of a list operation with one parameter (page) and no annotations or output schema, the description is incomplete. It lacks details on pagination behavior, return format, error handling, or prerequisites, which are essential for effective tool use. The usage hint helps but doesn't compensate for these gaps.

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?

Schema description coverage is 0%, so the description must compensate for the undocumented parameter 'page'. However, the description adds no information about parameters—it doesn't mention pagination, explain what 'page' means, or provide any semantic context. This fails to address the coverage gap, leaving the parameter's purpose unclear.

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 ('Lists') and resource ('all items in Xero'), making the purpose specific and understandable. It distinguishes from siblings by focusing on items rather than other resources like contacts or invoices, though it doesn't explicitly contrast with similar list tools like list-accounts or list-contacts.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: 'to get the item codes and descriptions to be used when creating invoices in Xero.' This gives practical guidance, though it doesn't explicitly state when not to use it or name specific alternatives among the many sibling tools.

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/XeroAPI/xero-mcp-server'

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