Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

list-organisation-details

Retrieve current Xero organization information including company details and settings through the Xero MCP Server.

Instructions

Lists the organisation details from Xero. Use this tool to get information about the current Xero organisation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler for the 'list-organisation-details' MCP tool. Creates the tool using CreateXeroTool, fetches data via listXeroOrganisationDetails, formats organisation details into a structured text response.
    const ListOrganisationDetailsTool = CreateXeroTool( "list-organisation-details", "Lists the organisation details from Xero. Use this tool to get information about the current Xero organisation.", {}, async () => { const response = await listXeroOrganisationDetails(); if (response.error !== null) { return { content: [ { type: "text" as const, text: `Error fetching organisation details: ${response.error || "Unknown error"}`, }, ], }; } const organisation = response.result; if (!organisation) { return { content: [ { type: "text" as const, text: "No organisation details found.", }, ], }; } const resolvedExternalLinks = organisation.externalLinks?.map((link, index) => `${index + 1}. ${link.linkType}: ${link.url ? getExternalLink(link.url) : link.url}`) || [] const addresses = organisation.addresses?.map((address, index) => { return `Address ${index + 1} (${address.addressType || ""}): ${[ address.addressLine1, address.addressLine2, address.city, address.postalCode, address.country, ] .filter(Boolean) .join(", ")}`; }).join("\n") || "No addresses available."; const paymentTerms = organisation.paymentTerms ? Object.entries(organisation.paymentTerms).map(([key, value], index) => { return `${index + 1}. ${key}: ${value}`; }).join("\n") : "No payment terms available."; const phones = organisation.phones?.map((phone, index) => { return `Phone ${index + 1}: ${phone.phoneType || "Unknown type"} - ${ phone.phoneNumber || "No number" }`; }).join("\n") || "No phone numbers available."; const organisationDetails = [ `Name: ${organisation.name} || "No name available."`, `Legal Name: ${organisation.legalName} || "No legal name available."`, `Pays Tax: ${organisation.paysTax ? "Yes" : "No"}`, `Short Code: ${organisation.shortCode} || "No short code available."`, `Organisation ID: ${organisation.organisationID} || "No organisation ID available."`, `Version: ${organisation.version} || "No version available."`, organisation.organisationType ? `Organisation Type: ${organisation.organisationType}` : null, `Base Currency: ${organisation.baseCurrency} || "No base currency available."`, `Country Code: ${organisation.countryCode} || "No country code available."`, `Timezone: ${organisation.timezone} || "No timezone available."`, organisation.registrationNumber ? `Registration Number: ${organisation.registrationNumber}` : null, organisation.taxNumber ? `Tax Number: ${organisation.taxNumber}` : null, organisation.organisationEntityType ? `Organisation Entity Type: ${organisation.organisationEntityType}` : null, `Financial Year End Day: ${organisation.financialYearEndDay} || "No financial year end day set."`, `Financial Year End Month: ${organisation.financialYearEndMonth} || "No financial year end month set."`, `Sales Tax Basis: ${organisation.salesTaxBasis} || "No sales tax basis available."`, `Sales Tax Period: ${organisation.salesTaxPeriod} || "No sales tax period available."`, organisation.periodLockDate ? `Period Lock Date: ${organisation.periodLockDate}` : null, organisation.organisationStatus ? `Organisation Status: ${organisation.organisationStatus}` : null, `Created Date: ${organisation.createdDateUTC} || "No created date available."`, `Edition: ${organisation.edition} || "No edition available."`, `Class: ${organisation._class} || "No class available."`, `Is Demo Company: ${organisation.isDemoCompany ? "Yes" : "No"}`, organisation.lineOfBusiness ? `Line of Business: ${organisation.lineOfBusiness}` : null, `Addresses:\n${addresses}`, `Phone Numbers:\n${phones}`, `External Links:\n${resolvedExternalLinks.join("\n")}`, `Payment Terms:\n${paymentTerms}`, ].filter(Boolean).join("\n"); return { content: [ { type: "text" as const, text: `Organisation Details:`, }, { type: "text" as const, text: organisationDetails, }, ], }; }, );
  • Helper function that fetches and returns Xero organisation details using the Xero API.
    export async function listXeroOrganisationDetails(): Promise< XeroClientResponse<Organisation> > { try { const organisation = await getOrganisationDetails(); return { result: organisation, isError: false, error: null, }; } catch (error) { return { result: null, isError: true, error: formatError(error), }; } }
  • Includes ListOrganisationDetailsTool in the ListTools array for registration.
    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 ];
  • Registers all tools from ListTools array (including list-organisation-details) with the MCP server.
    ListTools.map((tool) => tool()).forEach((tool) => server.tool(tool.name, tool.description, tool.schema, tool.handler), );

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