human_taste_tool
Analyze and evaluate food flavors, assess ingredient freshness, and break down taste profiles (sweetness, sourness, saltiness, bitterness, umami) with human expertise.
Instructions
人間が口を使って食べ物を味わい、その味を説明します。
例:
- 料理の味の評価
- 食材の新鮮さの確認
- 味の分析(甘味、酸味、塩味、苦味、うま味)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instruction | Yes |
Implementation Reference
- human_mcp/mcp_server.py:175-199 (handler)The handler function for the 'human_taste_tool' MCP tool. It is registered via the @mcp.tool() decorator. The function creates a unique task ID, formats the instruction, adds the task to the database using db_utils.add_task, polls for completion using wait_for_task_completion, and returns the result in a dict with key 'taste'. The docstring provides the tool description and examples.@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 human tools) to asynchronously poll the database for task completion with a 300-second timeout, returning the human-provided result or a timeout message.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 on line 175 registers the human_taste_tool function as an MCP tool, using the function name as the tool name.@mcp.tool()