Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

list-tracking-categories

Retrieve all tracking categories and their associated options from Xero to organize and categorize transactions for better financial reporting.

Instructions

List all tracking categories in Xero, along with their associated tracking options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeArchivedNoDetermines whether or not archived categories will be returned. By default, no archived categories will be returned.

Implementation Reference

  • Creates and exports the 'list-tracking-categories' MCP tool, including input schema, execution logic that fetches data from Xero handler and formats response as text.
    const ListTrackingCategoriesTool = CreateXeroTool(
      "list-tracking-categories",
      "List all tracking categories in Xero, along with their associated tracking options.",
      {
        includeArchived: z.boolean().optional()
          .describe("Determines whether or not archived categories will be returned. By default, no archived categories will be returned.")
      },
      async ({ includeArchived }) => {
        const response = await listXeroTrackingCategories(includeArchived);
    
        if (response.isError) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error listing tracking categories: ${response.error}`
              }
            ]
          };
        }
    
        const trackingCategories = response.result;
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Found ${trackingCategories?.length || 0} tracking categories:`
            },
            ...(trackingCategories?.map((category) => ({
              type: "text" as const,
              text: [
                `Tracking Category ID: ${category.trackingCategoryID}`,
                `Name: ${category.name}`,
                `Status: ${category.status}`,
                `Found ${category.options?.length || 0} tracking options:\n${category.options?.map(formatTrackingOption)}`
              ].filter(Boolean).join("\n")
            })) || [])
          ]
        };
      }
    );
  • Imports the ListTrackingCategoriesTool and registers it in the ListTools array for use in the MCP server.
    import ListTrackingCategoriesTool from "./list-tracking-categories.tool.js";
    import ListTrialBalanceTool from "./list-trial-balance.tool.js";
    import ListContactGroupsTool from "./list-contact-groups.tool.js";
    
    export const ListTools = [
      ListAccountsTool,
      ListContactsTool,
      ListCreditNotesTool,
      ListInvoicesTool,
      ListItemsTool,
      ListManualJournalsTool,
      ListQuotesTool,
      ListTaxRatesTool,
      ListTrialBalanceTool,
      ListPaymentsTool,
      ListProfitAndLossTool,
      ListBankTransactionsTool,
      ListPayrollEmployeesTool,
      ListReportBalanceSheetTool,
      ListOrganisationDetailsTool,
      ListPayrollEmployeeLeaveTool,
      ListPayrollLeavePeriodsToolTool,
      ListPayrollEmployeeLeaveTypesTool,
      ListPayrollEmployeeLeaveBalancesTool,
      ListPayrollLeaveTypesTool,
      ListAgedReceivablesByContact,
      ListAgedPayablesByContact,
      ListPayrollTimesheetsTool,
      ListContactGroupsTool,
      ListTrackingCategoriesTool
    ];
  • Core helper function that calls the Xero API to list tracking categories, handling authentication, API request, and errors.
    export async function listXeroTrackingCategories(
      includeArchived?: boolean
    ): Promise<XeroClientResponse<TrackingCategory[]>> {
      try {
        const trackingCategories = await getTrackingCategories(includeArchived);
    
        return {
          result: trackingCategories,
          isError: false,
          error: null
        };
      } catch (error) {
        return {
          result: null,
          isError: true,
          error: formatError(error)
        };
      }
    }
  • Helper function to format tracking option details for inclusion in the tool's text response.
    import { TrackingOption } from "xero-node";
    
    export const formatTrackingOption = (option: TrackingOption): string => {
      return [
        `Option ID: ${option.trackingOptionID}`,
        `Name: ${option.name}`,
        `Status: ${option.status}`
      ].join("\n");
    };
  • Zod schema defining the optional 'includeArchived' input parameter for the tool.
      includeArchived: z.boolean().optional()
        .describe("Determines whether or not archived categories will be returned. By default, no archived categories will be returned.")
    },
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 of behavioral disclosure. It states the tool lists categories and options, implying a read-only operation, but doesn't cover aspects like rate limits, authentication needs, error handling, or pagination. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse. Every part of the sentence contributes meaning, earning 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's low complexity (1 parameter, no output schema, no annotations), the description is minimally complete. It covers the basic purpose but lacks behavioral details and usage context. With no output schema, it doesn't explain return values, which is a gap, though the simplicity of the tool makes this less critical.

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, with the single parameter 'includeArchived' well-documented in the schema. The description adds no additional parameter information beyond what the schema provides, which is acceptable given the high coverage. Baseline score of 3 reflects adequate but no extra value.

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 action ('List all tracking categories') and resource ('in Xero'), with additional detail about including 'associated tracking options'. It distinguishes itself from sibling tools like 'create-tracking-category' or 'update-tracking-category' by focusing on retrieval rather than creation or modification. However, it doesn't explicitly differentiate from other list tools (e.g., 'list-contacts'), though the resource specificity helps.

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 explicit guidance is provided on when to use this tool versus alternatives. While it's implied for retrieving tracking categories, there's no mention of prerequisites, related tools (like 'create-tracking-category' for setup), or scenarios where other tools might be more appropriate. The description lacks context for decision-making.

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