Skip to main content
Glama

xero_accounts_list

List chart of accounts in Xero, filtering by account type or class to find specific accounts quickly.

Instructions

List chart of accounts in Xero. Optionally filter by account type or class.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
TypeNoFilter by account type (e.g., "BANK", "REVENUE", "EXPENSE", "CURRENT", "FIXED", "EQUITY", "CURRLIAB", "TERMLIAB", "DIRECTCOSTS", "OVERHEADS", "DEPRECIATN", "OTHERINCOME", "SALES")
ClassNoFilter by account class

Implementation Reference

  • Handler for the 'xero_accounts_list' tool. Builds optional Type/Class filters, calls client.get('Accounts', params), and returns the raw JSON response.
    case "xero_accounts_list": {
      const { Type, Class } = args as {
        Type?: string;
        Class?: string;
      };
      const params: Record<string, string> = {};
    
      // Build where clause from filters
      const filters: string[] = [];
      if (Type) filters.push(`Type=="${Type}"`);
      if (Class) filters.push(`Class=="${Class}"`);
      if (filters.length > 0) params.where = filters.join(" AND ");
    
      const response = await client.get("Accounts", params);
      return {
        content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
      };
    }
  • Tool definition and input schema for xero_accounts_list: name 'xero_accounts_list', description, and inputSchema with optional 'Type' (string) and 'Class' (enum: ASSET, EQUITY, EXPENSE, LIABILITY, REVENUE) properties.
    export const accountTools: Tool[] = [
      {
        name: "xero_accounts_list",
        description:
          "List chart of accounts in Xero. Optionally filter by account type or class.",
        inputSchema: {
          type: "object",
          properties: {
            Type: {
              type: "string",
              description:
                'Filter by account type (e.g., "BANK", "REVENUE", "EXPENSE", "CURRENT", "FIXED", "EQUITY", "CURRLIAB", "TERMLIAB", "DIRECTCOSTS", "OVERHEADS", "DEPRECIATN", "OTHERINCOME", "SALES")',
            },
            Class: {
              type: "string",
              enum: ["ASSET", "EQUITY", "EXPENSE", "LIABILITY", "REVENUE"],
              description: "Filter by account class",
            },
          },
        },
      },
  • src/index.ts:81-82 (registration)
    The accountTools array (containing xero_accounts_list definition) is collected in getDomainTools() and eventually registered in tools/list via getAllDomainTools(). Routing to handleAccountTool occurs at line 264.
    case "accounts":
      return accountTools;
  • The get() method on XeroClient (used by the handler to call the Xero API) delegates to this private request() method which constructs the URL, adds Bearer auth, and executes the HTTP GET.
    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);
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. It describes a read operation (listing) and filtering, but does not disclose potential pagination, authorization needs, or any side effects. It is basic but not misleading.

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, clear sentence with no extraneous information. It is appropriately front-loaded and succinct.

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?

The tool is simple with no required parameters and no output schema. However, it does not mention pagination, ordering, or the structure of the returned list, which would be helpful for an AI agent. Adequate but not fully detailed.

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 coverage is 100% with descriptions for both parameters. The description adds that filtering is optional, but does not add meaning beyond what the schema already provides. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and the resource 'chart of accounts in Xero', and specifies optional filtering by account type or class. This directly distinguishes it from sibling tool xero_accounts_get, which likely retrieves a single account.

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 implies usage for listing accounts with optional filters. While it does not explicitly state when not to use or name alternatives, the presence of a sibling 'get' tool makes the context clear. Lacking explicit exclusion guidance.

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