Skip to main content
Glama
klodr

mercury-invoicing-mcp

mercury_update_customer

Update an existing customer's contact details in Accounts Receivable. Pass only the fields to change—omitted fields keep their current values. Use when amending name, email, or billing address after creation.

Instructions

Update an existing Accounts Receivable customer. Pass only the fields you want to change.

USE WHEN: amending a customer's contact details (name, email, billing address) after creation. Existing invoices are not retroactively modified.

DO NOT USE: to delete a customer (use mercury_delete_customer). To change the customer of an existing invoice, cancel + recreate the invoice.

SIDE EFFECTS: writes the new customer record to Mercury. Persistent. Only the fields you pass are changed — omitted fields keep their current value.

RETURNS: { id, name, email, address, ... } — the updated customer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customerIdYesCustomer ID
nameNo
emailNo
addressNoCustomer billing address (Mercury requires `name` in the address)

Implementation Reference

  • The handler function for the mercury_update_customer tool. It destructures customerId from the args and uses the rest as the body for a PATCH request to /ar/customers/{customerId}. Called via defineTool which wraps it with rate limiting, dry-run, and audit middleware.
    async ({ customerId, ...body }) => {
      const data = await client.patch(`/ar/customers/${customerId}`, body);
      return textResult(data);
    },
  • The Zod input schema for mercury_update_customer. Requires customerId (UUID), with optional name, email, and billing address fields.
    customerId: z.string().uuid().describe("Customer ID"),
    name: z.string().optional(),
    email: z.string().email().optional(),
    address: addressSchema.optional(),
  • Registration of mercury_update_customer via defineTool() inside registerCustomerTools(). The defineTool function wraps the handler with middleware (rate limit, dry-run, audit) and calls server.registerTool.
    defineTool(
      server,
      "mercury_update_customer",
      [
        "Update an existing Accounts Receivable customer. Pass only the fields you want to change.",
        "",
        "USE WHEN: amending a customer's contact details (name, email, billing address) after creation. Existing invoices are not retroactively modified.",
        "",
        "DO NOT USE: to delete a customer (use `mercury_delete_customer`). To change the customer of an existing invoice, cancel + recreate the invoice.",
        "",
        "SIDE EFFECTS: writes the new customer record to Mercury. Persistent. Only the fields you pass are changed — omitted fields keep their current value.",
        "",
        "RETURNS: `{ id, name, email, address, ... }` — the updated customer.",
      ].join("\n"),
      {
        customerId: z.string().uuid().describe("Customer ID"),
        name: z.string().optional(),
        email: z.string().email().optional(),
        address: addressSchema.optional(),
      },
      async ({ customerId, ...body }) => {
        const data = await client.patch(`/ar/customers/${customerId}`, body);
        return textResult(data);
      },
    );
  • The registerCustomerTools function is called from src/tools/index.ts (registerAllTools), which is called from src/server.ts (createServer), which is called from src/index.ts (main). All customer tools are registered together.
    export function registerCustomerTools(server: McpServer, client: MercuryClient): void {
      defineTool(
        server,
        "mercury_list_customers",
        [
          "List Accounts Receivable customers, with cursor-based pagination.",
          "",
          "USE WHEN: enumerating AR customers before creating an invoice (need a `customerId` for `mercury_create_invoice`), or for a customer-level audit. Use `startAfter` / `endBefore` for paging beyond the limit.",
          "",
          "DO NOT USE: for payment recipients (`mercury_list_recipients` is the bank-payment counterparty list, distinct from AR customers). For one customer whose ID is known, prefer `mercury_get_customer`.",
          "",
          "RETURNS: `{ customers: [{ id, name, email, address, ... }] }`.",
        ].join("\n"),
        {
          limit: z.number().int().min(1).max(1000).optional().describe("Max results (1-1000)"),
          order: z.enum(["asc", "desc"]).optional(),
          startAfter: z.string().uuid().optional().describe("Pagination cursor (forward)"),
          endBefore: z.string().uuid().optional().describe("Pagination cursor (reverse)"),
        },
        async (args) => {
          const query: Record<string, string | number | undefined> = {
  • Rate-limit bucket assignment for mercury_update_customer, mapping it to the 'customers_write' bucket with daily limit of 3 and monthly limit of 60 (line 73).
    mercury_update_customer: "customers_write",
    mercury_delete_customer: "customers_write",
Behavior4/5

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

Describes side effects (writes persistently, partial update with omitted fields unchanged). No annotations provided, so description carries burden. Lacks details on permissions or error behavior but adequate for a simple update.

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?

Well-structured with clear sections (USE WHEN, DO NOT USE, SIDE EFFECTS, RETURNS), front-loaded with core action, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, usage, side effects, and return format. Missing potential error cases or validation details, but given tool complexity and no output schema, it provides sufficient guidance for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Description adds context (partial update, typical fields) beyond the 50% schema coverage. Mentions return structure but does not detail nested address beyond listing it. Schema covers properties, description clarifies behavior.

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?

Clearly identifies the action 'Update' and the resource 'customer', and distinguishes from sibling tools like mercury_delete_customer and mercury_create_customer.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use (amending contact details after creation) and when not to use (delete or change invoice customer), with specific sibling tool names, plus notes on retroactive effects.

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/klodr/mercury-invoicing-mcp'

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