mattrguerra/meridian-orders-mcpmainPrivate on GitHub, published here in full

getStatusCatalog.ts

Language TypeScript1.0 KB27 lines

mcp-server/src/tools/getStatusCatalog.ts

  1. import type { ToolModule } from "./types.js";
  2. import { plinthRequest } from "../lib/http.js";
  3. /**
  4. * get_status_catalog: the complete status-definition catalog (Plinth method
  5. * `statuses.list`). A lookup table, NOT a per-order query; all filter params,
  6. * order_ref included, are ignored.
  7. *
  8. * Wire notes:
  9. * - `status_code` is the STABLE identifier and is what appears on orders. The
  10. * `row_N` ordinal keys are NOT stable (the catalog gained an entry and
  11. * reshuffled between two pulls), so never hardcode them; re-pull on a
  12. * schedule and map by status_code.
  13. */
  14. export const getStatusCatalog: ToolModule = {
  15. name: "get_status_catalog",
  16. config: {
  17. title: "Get order-status catalog",
  18. description:
  19. "Return the full status-definition catalog mapping status_code to definitions. Lookup table, read-only.",
  20. inputSchema: {},
  21. },
  22. async handler(_args, ctx) {
  23. const body = await plinthRequest(ctx, "statuses.list");
  24. return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
  25. },
  26. };