getProduct.ts
Language TypeScript1.2 KB30 lines
import { z } from "zod";import type { ToolModule } from "./types.js";import { plinthRequest, type PlinthParams } from "../lib/http.js";/*** get_product: product specs and turnaround times (Plinth method* `products.fetch`). The parameter and response schemas have not been probed,* so the tool takes a passthrough `params` bag; tighten the inputSchema once a* live probe shows the real params. The guard in plinthRequest rejects any* reserved or write-intent key in the bag.*/export const getProduct: ToolModule = {name: "get_product",config: {title: "Get product info (unprobed)",description:"Product specs and turnaround times. Read-only. UNPROBED: parameter/response schema not yet verified.",inputSchema: {params: z.record(z.string(), z.union([z.string(), z.number()])).optional().describe("Raw passthrough params until the real schema is probed."),},},async handler(args, ctx) {const { params } = args as { params?: Record<string, string | number> };const body = await plinthRequest(ctx, "products.fetch", (params ?? {}) as PlinthParams);return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };},};