Skip to main content
Glama
XeroAPI

Xero MCP Server

Official

create-tracking-options

Add custom tracking options to Xero categories for organizing transactions by project, department, or other criteria.

Instructions

Create tracking options for a tracking category in Xero.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trackingCategoryIdYes
optionNamesYes

Implementation Reference

  • The handler function for the 'create-tracking-options' MCP tool. It calls the core Xero API handler, handles errors, and formats the response as MCP content blocks.
    async ({ trackingCategoryId, optionNames }) => {
      const response = await createXeroTrackingOptions(trackingCategoryId, optionNames);
    
      if (response.isError) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error while creating tracking options: ${response.error}`
            }
          ]
        };
      }
    
      const trackingOptions = response.result;
      
      return {
        content: [
          {
            type: "text" as const,
            text: `${trackingOptions.length || 0} out of ${optionNames.length} tracking options created:\n${trackingOptions.map(formatTrackingOption)}`
          },
        ]
      };
    }
  • Zod input schema defining the parameters: trackingCategoryId (string) and optionNames (array of up to 10 strings).
    trackingCategoryId: z.string(),
    optionNames: z.array(z.string()).max(10)
  • Final MCP server registration of the tool as part of CreateTools batch via server.tool().
    CreateTools.map((tool) => tool()).forEach((tool) =>
      server.tool(tool.name, tool.description, tool.schema, tool.handler),
  • Imports the tool and includes it in the CreateTools array for subsequent batch registration.
    import CreateTrackingOptionsTool from "./create-tracking-options.tool.js";
    
    export const CreateTools = [
      CreateContactTool,
      CreateCreditNoteTool,
      CreateManualJournalTool,
      CreateInvoiceTool,
      CreateQuoteTool,
      CreatePaymentTool,
      CreateItemTool,
      CreateBankTransactionTool,
      CreatePayrollTimesheetTool,
      CreateTrackingCategoryTool,
      CreateTrackingOptionsTool
  • Core helper function that performs parallel API calls to create tracking options in Xero and returns structured response.
    export async function createXeroTrackingOptions(
      trackingCategoryId: string,
      optionNames: string[]
    ): Promise<XeroClientResponse<TrackingOption[]>> {
      try {
        const createdOptions = await Promise.all(
          optionNames.map(async optionName => await createTrackingOption(trackingCategoryId, optionName))
        );
    
        return {
          result: createdOptions
            .filter(Boolean)
            .map(option => option as TrackingOption),
          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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Create' implies a write operation but fails to mention permissions, rate limits, idempotency, or what happens if options already exist. This leaves significant gaps for a mutation tool with no 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 a single, direct sentence with no wasted words, making it highly concise and front-loaded. It efficiently communicates the core action without unnecessary elaboration.

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?

For a mutation tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is inadequate. It lacks details on behavior, parameter meanings, error handling, and output, leaving the agent with insufficient context to use the tool effectively.

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 mentions 'tracking options for a tracking category' but does not clarify what 'trackingCategoryId' or 'optionNames' represent, their formats, or constraints like the 10-item max for 'optionNames'. This adds minimal value beyond the schema.

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 ('Create tracking options') and the target resource ('for a tracking category in Xero'), making the purpose evident. However, it does not differentiate this tool from its sibling 'create-tracking-category' or 'update-tracking-options', which limits its score to 4 instead of 5.

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-tracking-category' or 'update-tracking-options'. It lacks context about prerequisites, such as whether a tracking category must exist first, or any exclusions for usage.

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