get_history
Retrieve recent ComfyUI workflow generation history to view past jobs, their outputs, and status information for tracking and analysis.
Instructions
Get recent generation history.
Args:
limit: Maximum number of history entries (1-100, default: 10)
Returns history entries with outputs and status for each job.
Use this to see past generations and their results.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max entries to return |
Implementation Reference
- The MCP tool handler for 'get_history'. Fetches the recent ComfyUI generation history (up to 'limit' items) using the ComfyUI /history API endpoint. Includes input validation via Pydantic Field and error handling.@mcp.tool() def get_history( limit: int = Field(default=10, ge=1, le=100, description="Max entries to return"), ctx: Context = None, ) -> dict: """Get recent generation history. Args: limit: Maximum number of history entries (1-100, default: 10) Returns history entries with outputs and status for each job. Use this to see past generations and their results. """ if ctx: ctx.info(f"Fetching last {limit} history entries...") try: return comfy_get(f"/history?max_items={limit}") except Exception as e: return ErrorResponse.unavailable(str(e)).model_dump()
- src/comfy_mcp_server/tools/__init__.py:25-25 (registration)Within register_all_tools(mcp), calls register_system_tools(mcp) which defines and registers the get_history tool among system tools.register_system_tools(mcp)
- src/comfy_mcp_server/__init__.py:92-92 (registration)Top-level registration of all tools, which includes the system tools containing get_history.register_all_tools(mcp)
- src/comfy_mcp_server/api.py:219-221 (helper)Helper function in API module that performs the core API call for history, directly mirrored in the tool handler.def get_history(max_items: int = 10) -> dict: """Get generation history.""" return comfy_get(f"/history?max_items={max_items}")