UNPKG

@opra-app/mcp

Version:

MCP server for OPRA's business and discount data

25 lines (24 loc) 784 B
import { z } from "zod"; import { getBusinessDetails } from "../api.js"; export const registerGetBusinessDetailsTool = (server) => { server.tool("get-business-details", "Gets a business by ID", { id: z.string().describe("The ID of the business to get"), }, async ({ id }) => { try { const business = await getBusinessDetails(id); return { content: [{ type: "text", text: JSON.stringify(business) }], }; } catch (error) { return { content: [ { type: "text", text: `Failed to retrieve business with ID ${id}: ${error}`, }, ], }; } }); };