@opra-app/mcp
Version:
MCP server for OPRA's business and discount data
20 lines (19 loc) • 755 B
JavaScript
import { listCategories } from "../api.js";
export const registerListCategoriesTool = (server) => {
server.tool("list-categories", "Lists all discount categories (e.g. food, travel, electronics). Use the returned category IDs with list-discounts-in-category to find specific offers.", {}, async () => {
try {
const categories = await listCategories();
return {
content: [{ type: "text", text: JSON.stringify(categories, null, 2) }],
};
}
catch (error) {
return {
isError: true,
content: [
{ type: "text", text: `Failed to retrieve categories: ${error}` },
],
};
}
});
};