Skip to main content
Glama
upamune
by upamune

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
NameRequiredDescriptionDefault
instructionYes

Implementation Reference

  • 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}
  • 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)
  • The @mcp.tool() decorator registers the human_taste_tool function with the MCP server.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/upamune/human-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server