Skip to main content
Glama

train_prepare_dataset

Prepare and manage LoRA training datasets. Stage, list, inspect, edit, delete, and caption images so they're ready for ComfyUI training jobs.

Instructions

Stage and curate the training DATASETS a LoRA run consumes — the images and their captions. Datasets are keyed by name; the jobs that train on them live in the separate train_start tool and are keyed by id. Driven by the action parameter:

  • action:"prepare" — Stage training images + captions into a dataset dir the trainer consumes. Each item is an image (absolute path, OR a ComfyUI ref {filename,subfolder?,type?} resolved against the connected ComfyUI's output/input dirs — how phone/panel pickers hand over selections) with an optional caption (a missing caption falls back to defaultCaption — typically the trigger word). Requires name + items. Returns the datasetPath to pass to train_start (action:"start"). Character LoRA guidance: 10-30 varied images; caption what changes between images, keep the trigger word constant.

  • action:"list" — List staged datasets, newest-first, with image/caption counts. Read-only, takes no other parameters. Pair with action:"detail" to see one dataset's images + captions.

  • action:"detail" — Show ONE staged dataset by name: its dir (datasetPath — reusable as train_start's datasetPath) and every image with its caption (null when uncaptioned). Images render via action:"file". Read-only.

  • action:"update" — Edit a staged dataset by name: set/replace per-image captions (setCaptions) and/or delete individual images with their caption files (deleteImages). Refuses while a running/queued job trains from it. Returns per-file warnings for unknown files. This is the SURGICAL edit — it removes only the filenames you list, leaving the dataset itself in place.

  • action:"delete" — DESTROY a whole staged DATASET by name: every image and every caption under it. Irreversible, and the images are typically hand-curated and unrecoverable — confirm with the user first. Refuses while a running/queued job trains from it. THIS DELETES A DATASET, NOT A TRAINING JOB: to delete a finished job's record and checkpoints use the separate train_start tool with action:"delete", which is keyed by id rather than name. To remove only SOME images, use action:"update" with deleteImages.

  • action:"file" — Fetch an image under the training root (dataset image, job sample) by absolute path as an inline image — the tunnel-safe way for a phone/panel to render training files it can't reach over /view. Bounded: image files only, ≤ 2MB.

  • action:"caption_image" — Caption ONE image by absolute path with the user's own Claude subscription (one vision turn through the Agent SDK — not a paid API). Returns the bare caption and does NOT write it — review, then save with action:"update", or use action:"caption_dataset" to write directly. Optional guide steers the style; optional trigger is prepended by the model.

  • action:"caption_dataset" — Caption a whole staged dataset by name (or the only subset) with the user's own Claude subscription and WRITE the captions into its .txt files (one vision turn per image, sequential). Captioning ALWAYS runs through Claude (Agent SDK) regardless of the panel's active backend, so it needs a logged-in Claude Code session (or ANTHROPIC_API_KEY). Use after gathering images, before train_start (action:"start"). Per-file transient failures are reported without stopping the batch, but a persistent auth/credential failure stops immediately with an actionable error rather than failing every image. Optional guide steers all captions; optional trigger is prepended to each.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoDataset name — the staging dir name. REQUIRED for actions "prepare" (it is created), "detail", "update", "delete" and "caption_dataset" (from action:"list"). This is a DATASET name, never a training job id.
onlyNoaction:"caption_dataset" — subset of filenames to caption (default: all images).
pathNoAbsolute path of a file under the training root. REQUIRED for action:"file" (a dataset image or job sample, from action:"detail"'s datasetPath or train_start action:"status"'s samples) and for action:"caption_image" (the image to caption).
guideNoactions "caption_image"/"caption_dataset" — extra style guidance for the captioner (e.g. 'focus on outfits and backgrounds').
itemsNoaction:"prepare" — the images to stage. REQUIRED for that action.
actionYesWhich dataset operation to perform. "list" takes no other parameters; "prepare" requires `name` + `items`; "detail", "update", "delete" and "caption_dataset" require `name`; "file" and "caption_image" require `path`. NOTE "delete" here destroys a DATASET (images + captions) — deleting a training JOB is train_start action:"delete".
triggerNoactions "caption_image"/"caption_dataset" — trigger word to prepend to the caption(s).
setCaptionsNoaction:"update" — {filename: caption} pairs to write (replaces existing captions).
deleteImagesNoaction:"update" — image filenames to delete from the dataset (caption files go too). Removes only these files; action:"delete" removes the whole dataset.
defaultCaptionNoaction:"prepare" — fallback caption for items without one; usually the trigger word.
Behavior5/5

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

No annotations are provided, so the description carries the full burden. It discloses destruction ('DESTROY a whole staged DATASET... Irreversible'), refusal conditions ('Refuses while a running/queued job trains from it'), bounds ('≤ 2MB'), auth needs ('needs a logged-in Claude Code session'), and partial-failure behavior ('Per-file transient failures are reported without stopping the batch').

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 long, but the bullet-per-action structure makes it scannable and each sentence adds new information (prerequisites, return values, safety warnings). It front-loads the core keying concept (name vs id). Slightly verbose, but the length is justified by the eight-action complexity.

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

Completeness5/5

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

With no output schema and no annotations, the description must cover return values, side effects, ordering, and failure modes. It does: datasetPath, per-file warnings, caption returns, irreversibility, and auth failure behavior. The 100% schema coverage and eight-action enumeration leave no obvious gap.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds cross-parameter semantics: which action requires which params, how ref resolution works ('resolved against the connected ComfyUI's output/input dirs'), and the distinction between update/deleteImages and delete. It does not need to restate the schema but adds orchestration context that the schema alone lacks.

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 opens with 'Stage and curate the training DATASETS a LoRA run consumes — the images and their captions' and explicitly separates this from train_start ('the jobs that train on them live in the separate `train_start` tool and are keyed by `id`'). It enumerates eight distinct actions, making the verb+resource scoping unmistakable and distinguishing it from siblings.

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

Usage Guidelines5/5

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

It gives explicit sequencing ('Use after gathering images, before train_start (action:"start")'), alternative tools ('to delete a finished job's record and checkpoints use the separate train_start tool with action:"delete"'), and action-specific pairings ('Pair with action:"detail"'). Also includes practical guidance for when to use prepare (e.g., '10-30 varied images').

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/artokun/comfyui-mcp'

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