Integration reference

API & MCP

Connect support agents to the same live customer, inventory, conversation, and order data shown in this console.

Access

No authentication is required. Every REST and MCP endpoint below is open to the public, and no headers or tokens need to be sent.

MCP server

Streamable HTTP
POST https://traeger.decagon.tools/api/public/mcp

Protocol: JSON-RPC 2.0. Supported methods include initialize, ping, tools/list, and tools/call.

lookup_accountaccount_phoneFind an account (customer_id, first_name, last_name, customer_name, email, phone, address), its primary grill (preferring the one reporting an error), warranty_active, WiFIRE status, and latest error and timestamp.
check_warrantywarranty_grill_serial or warranty_phoneReturn grill_model, grill_serial, purchase_date, warranty status, end date and coverage. By phone, prefers the grill with an active error.
check_part_availabilityparts_grill_model, parts_error_codeFind compatible parts that resolve an error.
order_replacement_partorder_customer_id or order_phone, order_part_sku, order_idempotency_key?Create an order. Free (card not charged) when a compatible grill is under warranty; otherwise price + 8% tax. Returns list_price, warranty_covered, amount_charged, card_brand, card_last4, status.
lookup_ordersorders_customer_id or orders_phoneReturn the customer's order history, newest first: confirmation number, part, status, total, warranty coverage and estimated delivery.

Use a stable idempotency_key when retrying an order. It prevents duplicate charges and duplicate orders. If no key is sent, the x-decagon-conversation-id request header is used as {conversation_id}:{part_sku}.

Matching is forgiving: phone numbers match on the last 10 digits in any format; models and error codes ignore case and punctuation (PRO 575, Traeger Pro 575 → Pro 575; ER-13, Error 0013, 13 → Er13).

Conversation metadata: when the x-decagon-conversation-id header is present and the server has a DECAGON_API_KEY secret, each successful tool call also writes its key fields to that Decagon conversation via POST /conversation/update_metadata. Keys are prefixed decagon_ext_ (e.g. decagon_ext_account_id, decagon_ext_warranty_active, decagon_ext_order_id); values are limited to letters, digits, _ and - (spaces and punctuation become _, money is in cents). Every result includes metadata_sync: written, skipped or failed.

REST API

GET
/api/public/v1/customer?phone=...Customer and registered grills
GET
/api/public/v1/conversations?customer_id=...Conversation history
GET
/api/public/v1/parts?model=...&error_code=...Filtered parts inventory
GET
/api/public/v1/orders?customer_id=...Customer order history
POST
/api/public/v1/ordersCreate a replacement-part order

Create order body

{
  "customer_id": "cus_1001",
  "phone": "optional, instead of customer_id",
  "part_sku": "KIT0171",
  "idempotency_key": "optional-retry-key"
}

Error contract

Failures return compact codes without stack traces. Expected codes include account_not_found, grill_not_found, part_lookup_failed, part_not_found, out_of_stock, payment_failed, and invalid_request.

Tool source code

The live implementation of each tool, for keeping Decagon stubs word-for-word in sync. svc is the shared data layer used by the console, REST API and MCP server.

lookup_account
async function lookup_account(account_phone: string) {
  const r = await svc.getCustomerByPhone(account_phone).catch(() => null);
  const result: Record<string, unknown> = !r ? { error: "account_not_found" } : (() => {
    // Prefer the grill reporting an error.
    const g = r.grills.find((x) => x.latest_error_code) ?? r.grills[0];
    const latest_error_timestamp = g?.latest_error_code
      ? g.wifire.error_history.find((e) => e.code === g.latest_error_code)?.at ?? null
      : null;
    const grill_wifire_enabled = g ? !!(g.wifire.firmware_version || g.wifire.last_connected_at) : null;
    return {
      customer_id: r.customer.id, customer_name: r.customer.name,
      first_name: r.customer.first_name, last_name: r.customer.last_name,
      phone: r.customer.phone, email: r.customer.email,
      grill_model: g?.model ?? null, grill_serial: g?.serial ?? null, grill_wifire_enabled,
      latest_error_code: g?.latest_error_code ?? null, latest_error_timestamp,
      card_brand: r.customer.card_summary.brand, card_last4: r.customer.card_summary.last4,
      warranty_end_date: g?.warranty_end_date ?? null, warranty_active: g?.warranty_active ?? null,
      address: r.customer.address, grill_count: r.grills.length, error: null,
    };
  })();
  // Merge every result field into the conversation's existing metadata.
  Conversation.merge_metadata(result["metadata"]);
  return result;
}
check_warranty
async function check_warranty(args: { warranty_grill_serial?: string; warranty_phone?: string }) {
  let serial = args.warranty_grill_serial?.trim();
  if (!serial && args.warranty_phone) {
    const grills = (await svc.getCustomerByPhone(args.warranty_phone))?.grills ?? [];
    serial = (grills.find((x) => x.latest_error_code) ?? grills[0])?.serial;
  }
  const g = serial ? await svc.getGrillBySerial(serial) : null;
  const result: Record<string, unknown> = !g ? { error: "grill_not_found" } : {
    grill_model: g.model, grill_serial: g.serial, purchase_date: g.purchase_date,
    warranty_active: g.warranty_active, warranty_end_date: g.warranty_end_date,
    coverage: svc.warrantyCoverage(g.warranty_active),
  };
  // Merge every result field into the conversation's existing metadata.
  Conversation.merge_metadata(result["metadata"]);
  return result;
}
check_part_availability
async function check_part_availability(parts_grill_model: string, parts_error_code: string) {
  let result: Record<string, unknown>;
  if (!parts_grill_model || !parts_error_code) {
    result = { parts: [], error: "part_lookup_failed" };
  } else {
    try {
      const parts = await svc.listParts(parts_grill_model, parts_error_code);
      result = {
        parts: parts.map(({ sku, name, price, stock_status, est_shipping }) =>
          ({ sku, name, price, stock_status, est_shipping })),
      };
    } catch {
      result = { parts: [], error: "part_lookup_failed" };
    }
  }
  // Merge every result field into the conversation's existing metadata.
  Conversation.merge_metadata(result["metadata"]);
  return result;
}
order_replacement_part
async function order_replacement_part(args: {
  order_customer_id?: string; order_phone?: string;
  order_part_sku: string; order_idempotency_key?: string;
}, conversationId?: string) {
  let customer_id = args.order_customer_id?.trim();
  const phone = args.order_phone?.trim(), part_sku = args.order_part_sku?.trim();
  let result: Record<string, unknown>;
  if (!part_sku || (!customer_id && !phone)) {
    result = { error: "invalid_request" };
  } else {
    if (!customer_id && phone)
      customer_id = (await svc.getCustomerByPhone(phone).catch(() => null))?.customer.id;
    if (!customer_id) {
      result = { error: "account_not_found" };
    } else {
      const idempotency_key = args.order_idempotency_key?.trim()
        ?? (conversationId ? `${conversationId}:${part_sku}` : undefined);
      try {
        const o = await svc.createOrder({ customer_id, part_sku, idempotency_key, source: "agent" });
        result = svc.orderResponse(o);
      } catch (e) {
        result = { error: e instanceof svc.ServiceError ? e.code : "order_failed" };
      }
    }
  }
  // Merge every result field into the conversation's existing metadata.
  Conversation.merge_metadata(result["metadata"]);
  return result;
}
lookup_orders
async function lookup_orders(args: { orders_customer_id?: string; orders_phone?: string }) {
  let customer_id = args.orders_customer_id?.trim();
  const phone = args.orders_phone?.trim();
  let result: Record<string, unknown>;
  if (!customer_id && !phone) {
    result = { error: "invalid_request" };
  } else {
    if (!customer_id && phone)
      customer_id = (await svc.getCustomerByPhone(phone).catch(() => null))?.customer.id;
    if (!customer_id) {
      result = { error: "account_not_found" };
    } else {
      const orders = await svc.listOrders(customer_id);
      result = {
        customer_id, order_count: orders.length,
        orders: orders.slice(0, 10).map((o) => ({
          confirmation_number: o.confirmation_number, part_name: o.part_name, part_sku: o.part_sku,
          status: o.status, total: o.total, warranty_covered: o.warranty_covered,
          est_delivery_date: o.est_delivery_date, created_at: o.created_at,
        })),
      };
    }
  }
  // Merge every result field into the conversation's existing metadata.
  Conversation.merge_metadata(result["metadata"]);
  return result;
}

Merging metadata after each call

// Every tool above already ends with this step — it merges the result's
// metadata object (every result field, decagon_ext_ prefixed) into the
// conversation's existing metadata:
Conversation.merge_metadata(result["metadata"])