human_taste_tool
Analyze food flavors and quality by having humans taste and describe sweetness, sourness, saltiness, bitterness, and umami to evaluate dishes or ingredients.
Instructions
人間が口を使って食べ物を味わい、その味を説明します。
例:
- 料理の味の評価
- 食材の新鮮さの確認
- 味の分析(甘味、酸味、塩味、苦味、うま味)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instruction | Yes |
Implementation Reference
- human_mcp/mcp_server.py:175-199 (handler)The core handler function for the 'human_taste_tool'. It is registered via the @mcp.tool() decorator. The function creates a unique task ID, formats the taste instruction, stores it in the database using db_utils.add_task, polls for completion using wait_for_task_completion, and returns the human-provided taste description.@mcp.tool() async def human_taste_tool(instruction: str, ctx: Context) -> Dict[str, str]: """人間が口を使って食べ物を味わい、その味を説明します。 例: - 料理の味の評価 - 食材の新鮮さの確認 - 味の分析(甘味、酸味、塩味、苦味、うま味) """ task_id = str(uuid.uuid4()) formatted_instruction = f"👅 口を使って味わう: {instruction}" # タスクをデータベースに追加 db_utils.add_task(task_id, formatted_instruction) # ログ出力 sys.stderr.write(f"Human task created: {task_id}. Waiting for completion...\n") # 結果を待機(非同期ポーリング) result = await wait_for_task_completion(task_id) # ログ出力 sys.stderr.write(f"Human task {task_id} completed.\n") return {"taste": result}
- human_mcp/mcp_server.py:201-219 (helper)Helper function used by human_taste_tool (and other tools) to asynchronously poll the database for task completion with a timeout.async def wait_for_task_completion(task_id: str, timeout: int = 300) -> str: """タスクの完了を待機する(タイムアウト付き)""" start_time = asyncio.get_event_loop().time() while True: # 現在の経過時間を確認 elapsed = asyncio.get_event_loop().time() - start_time if elapsed > timeout: return f"タイムアウト: {timeout}秒経過しても応答がありませんでした。" # タスクの状態を確認 status, result = db_utils.get_task_result(task_id) if status == 'completed' and result is not None: return result # 1秒待機してから再確認 await asyncio.sleep(1)
- human_mcp/mcp_server.py:175-175 (registration)The @mcp.tool() decorator registers the human_taste_tool function with the MCP server.@mcp.tool()