@opra-app/mcp
Version:
MCP server for OPRA's business and discount data
20 lines (19 loc) • 722 B
JavaScript
import { listBusinesses } from "../api.js";
export const registerListBusinessesTool = (server) => {
server.tool("list-businesses", "Lists all businesses that offer discounts through OPRA. Use get-business-details with the returned IDs for full info.", {}, async () => {
try {
const businesses = await listBusinesses();
return {
content: [{ type: "text", text: JSON.stringify(businesses, null, 2) }],
};
}
catch (error) {
return {
isError: true,
content: [
{ type: "text", text: `Failed to retrieve businesses: ${error}` },
],
};
}
});
};