recommend_temples
Find Kyoto temples matching your travel preferences by entering natural language queries about your profile, interests, and requirements.
Instructions
自然言語のクエリに基づいて京都の寺院をスコア付きで推薦する。旅行者のプロファイル・希望・条件を自由に入力できる。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | 旅行者のプロファイルや希望(例:「40代夫婦・歴史好き・混雑嫌い・半日」「一人旅・禅・静かな場所」「子供連れ・無料・世界遺産」) | |
| limit | No | 返す件数(デフォルト5件) |
Implementation Reference
- src/index.js:121-175 (handler)The registration and handler implementation for the recommend_temples MCP tool. It uses a scoring function to rank temples based on a natural language query.
server.tool( "recommend_temples", "自然言語のクエリに基づいて京都の寺院をスコア付きで推薦する。旅行者のプロファイル・希望・条件を自由に入力できる。", { query: z.string().describe( "旅行者のプロファイルや希望(例:「40代夫婦・歴史好き・混雑嫌い・半日」「一人旅・禅・静かな場所」「子供連れ・無料・世界遺産」)" ), limit: z.number().optional().default(5).describe("返す件数(デフォルト5件)"), }, async ({ query, limit = 5 }) => { // 各寺院をスコアリング const scored = temples.map((temple) => { const { score, reasons } = scoreTemple(temple, query); const templeTopics = topics .filter((t) => t.temple === temple.id) .map((t) => t.topic) .slice(0, 3); return { name: temple.name, slug: temple.id, score, reason: buildReason(temple, reasons, query), tags: temple.tags.slice(0, 5), crowd_level: temple.crowd_level, price: temple.price, time_required: temple.time_required, highlights: temple.highlights, topics: templeTopics, url: temple.url, }; }); // スコア降順でソート scored.sort((a, b) => b.score - a.score); const results = scored.slice(0, limit); return { content: [ { type: "text", text: JSON.stringify( { query, total_results: results.length, results, }, null, 2 ), }, ], }; } );