@opra-app/mcp
Version:
MCP server for OPRA's business and discount data
20 lines (19 loc) • 691 B
JavaScript
import { getCities } from "../api.js";
export const registerListCitiesTool = (server) => {
server.tool("list-cities", "Lists all Norwegian cities that have local discounts available. Use the returned city IDs with get-discount-by-city.", {}, async () => {
try {
const cities = await getCities();
return {
content: [{ type: "text", text: JSON.stringify(cities, null, 2) }],
};
}
catch (error) {
return {
isError: true,
content: [
{ type: "text", text: `Failed to retrieve cities: ${error}` },
],
};
}
});
};