@opra-app/mcp
Version:
MCP server for OPRA's business and discount data
19 lines (18 loc) • 594 B
JavaScript
import { listCategories } from "../api.js";
export const registerListCategoriesTool = (server) => {
server.tool("list-categories", "Lists all discount categories", {}, async () => {
try {
const categories = await listCategories();
return {
content: [{ type: "text", text: JSON.stringify(categories) }],
};
}
catch (error) {
return {
content: [
{ type: "text", text: `Failed to retrieve categories: ${error}` },
],
};
}
});
};