Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

update-contact

Modify contact details in Xero and receive a direct link to view the updated contact record.

Instructions

Update a contact in Xero. When a contact is updated, a deep link to the contact in Xero is returned. This deep link can be used to view the contact in Xero directly. This link should be displayed to the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactIdYes
nameYes
firstNameNo
lastNameNo
emailNo
phoneNo
addressNo

Implementation Reference

  • The MCP tool handler function for 'update-contact'. It invokes the underlying updateXeroContact handler, handles success/error responses, generates a deep link to the contact, and returns formatted content.
    async ({
      contactId,
      name,
      firstName,
      lastName,
      email,
      phone,
      address,
    }: {
      contactId: string;
      name: string;
      email?: string;
      phone?: string;
      address?: {
        addressLine1: string;
        addressLine2?: string;
        city?: string;
        region?: string;
        postalCode?: string;
        country?: string;
      };
      firstName?: string;
      lastName?: string;
    }) => {
      try {
        const response = await updateXeroContact(
          contactId,
          name,
          firstName,
          lastName,
          email,
          phone,
          address,
        );
        if (response.isError) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error updating contact: ${response.error}`,
              },
            ],
          };
        }
    
        const contact = response.result;
    
        const deepLink = contact.contactID
          ? await getDeepLink(DeepLinkType.CONTACT, contact.contactID)
          : null;
    
        return {
          content: [
            {
              type: "text" as const,
              text: [
                `Contact updated: ${contact.name} (ID: ${contact.contactID})`,
                deepLink ? `Link to view: ${deepLink}` : null,
              ]
                .filter(Boolean)
                .join("\n"),
            },
          ],
        };
      } catch (error) {
        const err = ensureError(error);
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Error creating contact: ${err.message}`,
            },
          ],
        };
      }
    },
  • Zod input schema defining parameters for the update-contact tool: contactId, name, firstName, lastName, email, phone, address.
    {
      contactId: z.string(),
      name: z.string(),
      firstName: z.string().optional(),
      lastName: z.string().optional(),
      email: z.string().email().optional(),
      phone: z.string().optional(),
      address: z
        .object({
          addressLine1: z.string(),
          addressLine2: z.string().optional(),
          city: z.string().optional(),
          region: z.string().optional(),
          postalCode: z.string().optional(),
          country: z.string().optional(),
        })
        .optional(),
    },
  • Includes UpdateContactTool in the UpdateTools export array for batch registration.
    export const UpdateTools = [
      UpdateContactTool,
      UpdateCreditNoteTool,
      UpdateInvoiceTool,
      UpdateManualJournalTool,
      UpdateQuoteTool,
      UpdateItemTool,
      UpdateBankTransactionTool,
      ApprovePayrollTimesheetTool,
      AddTimesheetLineTool,
      UpdatePayrollTimesheetLineTool,
      RevertPayrollTimesheetTool,
      UpdateTrackingCategoryTool,
      UpdateTrackingOptionsTool
    ];
  • Batch registers all tools from UpdateTools (including update-contact) with the MCP server via server.tool().
    UpdateTools.map((tool) => tool()).forEach((tool) =>
      server.tool(tool.name, tool.description, tool.schema, tool.handler),
    );
  • Core implementation of contact update logic using Xero API: constructs Contact object and calls xeroClient.accountingApi.updateContact.
    export async function updateXeroContact(
      contactId: string,
      name: string,
      firstName?: string,
      lastName?: string,
      email?: string,
      phone?: string,
      address?: Address,
    ): Promise<XeroClientResponse<Contact>> {
      try {
        const updatedContact = await updateContact(
          name,
          firstName,
          lastName,
          email,
          phone,
          address,
          contactId,
        );
    
        if (!updatedContact) {
          throw new Error("Contact update failed.");
        }
    
        return {
          result: updatedContact,
          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?

With no annotations provided, the description must fully disclose behavioral traits. It mentions that a deep link is returned and should be displayed, which adds some context about output behavior. However, it lacks critical details: whether the update is idempotent, what permissions are required, if it's rate-limited, how partial updates are handled, or error responses. This leaves significant gaps for a mutation tool.

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 concise and front-loaded with the core action ('Update a contact in Xero'). The additional sentences about the deep link are relevant but could be more tightly integrated. Overall, it avoids fluff and stays focused, though it could be slightly more structured.

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 (7 parameters, nested objects, no output schema, no annotations), the description is incomplete. It covers the basic action and output format but misses parameter explanations, error handling, side effects, and differentiation from siblings. For a mutation tool with rich input schema, this leaves too much unspecified.

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 by explaining parameters. It provides no information about any of the 7 parameters (e.g., what 'contactId' refers to, how 'name' interacts with 'firstName'/'lastName', address structure). This leaves the agent reliant solely on the schema without semantic guidance, which is inadequate given the coverage gap.

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 ('Update a contact in Xero') and specifies the resource ('contact'), making the purpose immediately understandable. However, it does not differentiate this tool from its sibling 'update-*' tools (e.g., update-bank-transaction, update-invoice) beyond the contact focus, which slightly limits clarity in a crowded toolset.

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?

The description provides no guidance on when to use this tool versus alternatives like 'create-contact' or 'list-contacts'. It mentions the output (a deep link) but does not specify prerequisites, error conditions, or contextual triggers for choosing this update operation over others.

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