getStatusCatalog.ts
Language TypeScript1.0 KB27 lines
import type { ToolModule } from "./types.js";import { plinthRequest } from "../lib/http.js";/*** get_status_catalog: the complete status-definition catalog (Plinth method* `statuses.list`). A lookup table, NOT a per-order query; all filter params,* order_ref included, are ignored.** Wire notes:* - `status_code` is the STABLE identifier and is what appears on orders. The* `row_N` ordinal keys are NOT stable (the catalog gained an entry and* reshuffled between two pulls), so never hardcode them; re-pull on a* schedule and map by status_code.*/export const getStatusCatalog: ToolModule = {name: "get_status_catalog",config: {title: "Get order-status catalog",description:"Return the full status-definition catalog mapping status_code to definitions. Lookup table, read-only.",inputSchema: {},},async handler(_args, ctx) {const body = await plinthRequest(ctx, "statuses.list");return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };},};