Skip to main content
Glama

Get ComfyUI History

comfy_get_history

Retrieve the generation history for a specific ComfyUI prompt ID to track video creation progress and access previous outputs.

Instructions

Read ComfyUI generation history by prompt id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetNolocal
promptIdYes

Implementation Reference

  • Handler function for comfy_get_history: fetches ComfyUI generation history by prompt ID from the /history endpoint.
      async ({ target, promptId }) => {
        try {
          const res = await fetch(`${comfyUrl(target)}/history/${encodeURIComponent(promptId)}`);
          const body = await res.json().catch(() => ({}));
          if (!res.ok) return errorResult(`ComfyUI history failed: ${res.status}`, body);
          return textResult(body);
        } catch (err) {
          return errorResult('Failed to get ComfyUI history', String(err));
        }
      }
    );
  • Schema definition for comfy_get_history: input validation using Zod with target (local/cloud) and promptId fields.
    {
      title: 'Get ComfyUI History',
      description: 'Read ComfyUI generation history by prompt id.',
      inputSchema: z.object({
        target: z.enum(['local', 'cloud']).default('local'),
        promptId: z.string()
      })
  • Registration of comfy_get_history tool via server.registerTool inside registerComfyTools function.
    server.registerTool(
      'comfy_get_history',
      {
        title: 'Get ComfyUI History',
        description: 'Read ComfyUI generation history by prompt id.',
        inputSchema: z.object({
          target: z.enum(['local', 'cloud']).default('local'),
          promptId: z.string()
        })
      },
      async ({ target, promptId }) => {
        try {
          const res = await fetch(`${comfyUrl(target)}/history/${encodeURIComponent(promptId)}`);
          const body = await res.json().catch(() => ({}));
          if (!res.ok) return errorResult(`ComfyUI history failed: ${res.status}`, body);
          return textResult(body);
        } catch (err) {
          return errorResult('Failed to get ComfyUI history', String(err));
        }
      }
    );
  • Helper function comfyUrl() that resolves the base URL for local or cloud ComfyUI instance.
    export function comfyUrl(target: Target) {
      if (target === 'cloud') {
        if (!config.comfyCloudUrl) throw new Error('COMFY_CLOUD_URL is not configured');
        return config.comfyCloudUrl.replace(/\/$/, '');
      }
      return config.comfyLocalUrl.replace(/\/$/, '');
    }
  • Helper functions textResult and errorResult used by the handler to format success/error responses.
    export function textResult(data: unknown) {
      const text = typeof data === 'string' ? data : JSON.stringify(data, null, 2);
      return { content: [{ type: 'text' as const, text }] };
    }
    
    export function errorResult(message: string, details?: unknown) {
      return {
        isError: true,
        content: [{ type: 'text' as const, text: JSON.stringify({ error: message, details }, null, 2) }]
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description only states 'Read' implying non-destructive behavior, but no annotations are provided. It lacks details about authentication, rate limits, or what the returned history contains. As a simple read operation, more context could be helpful.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, six words, front-loaded with the verb and resource. It is very concise but may sacrifice necessary details. Every word earns its place, but it could be slightly longer for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, no output schema), the description is incomplete. It does not clarify the 'target' parameter or the format/content of the returned history. The agent would need to infer these details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has two parameters, but the description only addresses 'promptId' implicitly. The 'target' parameter (enum local/cloud) is not explained. With 0% schema description coverage, the description should compensate but does not add semantic value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Read' and resource 'ComfyUI generation history', and specifies the key parameter 'by prompt id'. It distinguishes from siblings like comfy_submit_workflow or ffmpeg_transcode, which perform different actions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. There is no mention of when not to use it or any contextual hints about its place among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Eliveral/codex-mcp-comfy-ae-video-factory-mcp'

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