Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

list-tax-rates

Retrieve tax rates from Xero to accurately apply them when creating invoices, ensuring proper tax calculations for financial transactions.

Instructions

Lists all tax rates in Xero. Use this tool to get the tax rates to be used when creating invoices in Xero

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler implementation for the 'list-tax-rates' tool. Creates the tool using CreateXeroTool with empty input schema and formats the tax rates into a detailed text response.
    const ListTaxRatesTool = CreateXeroTool(
      "list-tax-rates",
      "Lists all tax rates in Xero. Use this tool to get the tax rates to be used when creating invoices in Xero",
      {},
      async () => {
        const response = await listXeroTaxRates();
        if (response.error !== null) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error listing tax rates: ${response.error}`,
              },
            ],
          };
        }
    
        const taxRates = response.result;
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Found ${taxRates?.length || 0} tax rates:`,
            },
            ...(taxRates?.map((taxRate) => ({
              type: "text" as const,
              text: [
                `Tax Rate: ${taxRate.name || "Unnamed"}`,
                `Tax Type: ${taxRate.taxType || "No tax type"}`,
                `Status: ${taxRate.status || "Unknown status"}`,
                `Display Tax Rate: ${taxRate.displayTaxRate || "0.0000"}%`,
                `Effective Rate: ${taxRate.effectiveRate || "0.0000"}%`,
                taxRate.taxComponents?.length
                  ? `Tax Components:\n${taxRate.taxComponents
                      .map(
                        (comp) =>
                          `  - ${comp.name}: ${comp.rate}%${comp.isCompound ? " (Compound)" : ""}${comp.isNonRecoverable ? " (Non-recoverable)" : ""}`,
                      )
                      .join("\n")}`
                  : null,
                `Can Apply To:${[
                  taxRate.canApplyToAssets ? " Assets" : "",
                  taxRate.canApplyToEquity ? " Equity" : "",
                  taxRate.canApplyToExpenses ? " Expenses" : "",
                  taxRate.canApplyToLiabilities ? " Liabilities" : "",
                  taxRate.canApplyToRevenue ? " Revenue" : "",
                ].join("")}`,
              ]
                .filter(Boolean)
                .join("\n"),
            })) || []),
          ],
        };
      },
    );
  • Core handler function that performs the actual API call to Xero to list tax rates, handles errors, and returns structured response.
    export async function listXeroTaxRates(): Promise<
      XeroClientResponse<TaxRate[]>
    > {
      try {
        const taxRates = await getTaxRates();
    
        return {
          result: taxRates,
          isError: false,
          error: null,
        };
      } catch (error) {
        return {
          result: null,
          isError: true,
          error: formatError(error),
        };
      }
    }
  • Imports the ListTaxRatesTool and includes it in the exported ListTools array for grouping list-related tools.
    import ListTaxRatesTool from "./list-tax-rates.tool.js";
    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,
  • Helper factory function used to standardize the creation of all Xero MCP tools, including schema and handler binding.
    export const CreateXeroTool =
      <Args extends ZodRawShapeCompat>(
        name: string,
        description: string,
        schema: Args,
        handler: ToolCallback<Args>,
      ): (() => ToolDefinition<ZodRawShapeCompat>) =>
      () => ({
        name: name,
        description: description,
        schema: schema,
        handler: handler,
      });
  • Internal helper function that handles Xero client authentication and API call to retrieve tax rates.
    async function getTaxRates(): Promise<TaxRate[]> {
      await xeroClient.authenticate();
    
      const taxRates = await xeroClient.accountingApi.getTaxRates(
        xeroClient.tenantId,
        undefined, // where
        undefined, // order
        getClientHeaders(),
      );
      return taxRates.body.taxRates ?? [];
    }
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 mentions the action ('Lists') but does not describe traits like pagination, rate limits, authentication needs, or what the output looks like (e.g., format or fields). This leaves significant gaps for a tool with zero annotation coverage.

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 two sentences that are front-loaded and efficient, with no wasted words. Every sentence adds value: the first states the purpose, and the second provides usage guidance, making it appropriately sized and well-structured.

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 (0 parameters, no output schema, no annotations), the description is adequate but has gaps. It covers purpose and usage but lacks details on behavioral traits like output format or operational constraints, which are needed for full completeness in the absence of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not add parameter details, which is appropriate, and it compensates by providing usage context. Baseline is 4 for zero parameters, as the schema fully covers the lack of inputs.

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 tax rates in Xero'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'list-accounts' or 'list-contacts', which follow similar patterns for other resources, so it misses full sibling distinction.

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?

It provides clear context on when to use this tool ('to get the tax rates to be used when creating invoices in Xero'), which is helpful for guiding usage. However, it does not specify when not to use it or name alternatives among siblings, such as other list tools for different resources, so it lacks explicit exclusions or comparisons.

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