Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

update-manual-journal

Modify draft manual journals in Xero by updating narration, line items, dates, or status while preserving unspecified parameters.

Instructions

Update a manual journal in Xero. Only works on draft manual journals. Do not modify line items or parameters that have not been specified by the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
narrationYesDescription of manual journal being posted
manualJournalIDYesID of the manual journal to update
manualJournalLinesYesThe manualJournalLines element must contain at least two individual manualJournalLine sub-elements
dateNoOptional date in YYYY-MM-DD format
lineAmountTypesNoOptional line amount types (EXCLUSIVE, INCLUSIVE, NO_TAX), NO_TAX by default
statusNoOptional status of the manual journal (DRAFT, POSTED, DELETED, VOID, ARCHIVED), DRAFT by default
urlNoOptional URL link to a source document
showOnCashBasisReportsNoOptional boolean to show on cash basis reports, default is true

Implementation Reference

  • MCP tool definition for 'update-manual-journal', including schema validation and handler function that invokes the Xero API via updateXeroManualJournal and formats response with deeplink.
    const UpdateManualJournalTool = CreateXeroTool(
      "update-manual-journal",
      "Update a manual journal in Xero. Only works on draft manual journals.\
      Do not modify line items or parameters that have not been specified by the user.",
      {
        narration: z
          .string()
          .describe("Description of manual journal being posted"),
        manualJournalID: z.string().describe("ID of the manual journal to update"),
        manualJournalLines: z
          .array(
            z.object({
              lineAmount: z
                .number()
                .describe(
                  "Total for manual journal line. Debits are positive, credits are negative value",
                ),
              accountCode: z.string().describe("Account code for the journal line"),
              description: z
                .string()
                .optional()
                .describe("Optional description for manual journal line"),
              taxType: z
                .string()
                .optional()
                .describe("Optional tax type for the manual journal line"),
              // TODO: TODO: tracking can be added here
            }),
          )
          .describe(
            "The manualJournalLines element must contain at least two individual manualJournalLine sub-elements",
          ),
        date: z.string().optional().describe("Optional date in YYYY-MM-DD format"),
        lineAmountTypes: z
          .enum(["EXCLUSIVE", "INCLUSIVE", "NO_TAX"])
          .optional()
          .describe(
            "Optional line amount types (EXCLUSIVE, INCLUSIVE, NO_TAX), NO_TAX by default",
          ),
        status: z
          .enum(["DRAFT", "POSTED", "DELETED", "VOID", "ARCHIVED"])
          .optional()
          .describe(
            "Optional status of the manual journal (DRAFT, POSTED, DELETED, VOID, ARCHIVED), DRAFT by default",
          ),
        url: z
          .string()
          .optional()
          .describe("Optional URL link to a source document"),
        showOnCashBasisReports: z
          .boolean()
          .optional()
          .describe(
            "Optional boolean to show on cash basis reports, default is true",
          ),
      },
      async (args) => {
        try {
          const response = await updateXeroManualJournal(
            args.narration,
            args.manualJournalID,
            args.manualJournalLines,
            args.date,
            args.lineAmountTypes as LineAmountTypes | undefined,
            args.status as ManualJournal.StatusEnum | undefined,
            args.url,
            args.showOnCashBasisReports,
          );
    
          if (response.isError) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error updating manual journal: ${response.error}`,
                },
              ],
            };
          }
    
          const manualJournal = response.result;
          const deepLink = manualJournal.manualJournalID
            ? await getDeepLink(
                DeepLinkType.MANUAL_JOURNAL,
                manualJournal.manualJournalID,
              )
            : null;
    
          return {
            content: [
              {
                type: "text" as const,
                text: [
                  `Manual journal updated: ${manualJournal.narration} (ID: ${manualJournal.manualJournalID})`,
                  deepLink ? `Link to view: ${deepLink}` : null,
                ]
                  .filter(Boolean)
                  .join("\n"),
              },
            ],
          };
        } catch (error) {
          const err = ensureError(error);
    
          return {
            content: [
              {
                type: "text" as const,
                text: `Error updating manual journal: ${err.message}`,
              },
            ],
          };
        }
      },
    );
  • Core business logic handler that calls the Xero API to update a manual journal and returns structured response.
    export async function updateXeroManualJournal(
      narration: string,
      manualJournalID: string,
      manualJournalLines: ManualJournalLine[],
      date?: string,
      lineAmountTypes?: LineAmountTypes,
      status?: ManualJournal.StatusEnum,
      url?: string,
      showOnCashBasisReports?: boolean,
    ): Promise<XeroClientResponse<ManualJournal>> {
      try {
        const updatedManualJournal = await updateManualJournal(
          narration,
          manualJournalID,
          manualJournalLines,
          date,
          lineAmountTypes,
          status,
          url,
          showOnCashBasisReports,
        );
    
        if (!updatedManualJournal) {
          throw new Error("Manual journal update failed.");
        }
    
        return {
          result: updatedManualJournal,
          isError: false,
          error: null,
        };
      } catch (error) {
        return {
          result: null,
          isError: true,
          error: formatError(error),
        };
      }
    }
  • Registers the UpdateManualJournalTool as part of the UpdateTools array, which is used in tool factory for MCP tool registration.
    export const UpdateTools = [
      UpdateContactTool,
      UpdateCreditNoteTool,
      UpdateInvoiceTool,
      UpdateManualJournalTool,
      UpdateQuoteTool,
      UpdateItemTool,
      UpdateBankTransactionTool,
      ApprovePayrollTimesheetTool,
      AddTimesheetLineTool,
      UpdatePayrollTimesheetLineTool,
      RevertPayrollTimesheetTool,
      UpdateTrackingCategoryTool,
      UpdateTrackingOptionsTool
    ];
Behavior3/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. It discloses key behavioral traits: the tool only works on draft journals and should not modify unspecified parameters, which are important constraints. However, it lacks details on permissions, error handling, or mutation effects (e.g., whether updates are reversible), leaving gaps in behavioral context.

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, front-loaded with the main purpose and followed by critical constraints. Every sentence earns its place by providing essential information without redundancy or fluff, making it highly efficient 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 complexity (8 parameters, no annotations, no output schema), the description is adequate but incomplete. It covers key usage constraints but lacks details on return values, error cases, or broader context (e.g., how it fits with other Xero operations). For a mutation tool with no structured safety hints, more behavioral disclosure would be beneficial.

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 description coverage is 100%, so the schema fully documents all parameters. The description does not add any additional meaning or syntax details beyond what the schema provides (e.g., it doesn't explain parameter interactions or provide examples). Thus, it meets the baseline but adds 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 ('Update a manual journal in Xero') and resource ('manual journal'), making the purpose explicit. However, it does not distinguish this tool from sibling tools like 'update-bank-transaction' or 'update-invoice', which also perform updates in Xero, so it lacks sibling differentiation.

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 provides clear context for when to use this tool ('Only works on draft manual journals') and includes a constraint ('Do not modify line items or parameters that have not been specified by the user'). However, it does not explicitly mention alternatives (e.g., 'create-manual-journal' for new journals or other update tools for different resources), so it falls short of full explicit 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/XeroAPI/xero-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server