Start drawing a book
create_bookStarts drawing a book from a ready plan (plan_book) and returns job_id and project_id at once; poll job_id with get_job (it waits up to 25 s a call) until done. Costs, in pages of the account’s balance: coloring 1 per page, storybook 1 per page, comic 2 per page, puzzle 1 per puzzle (solution pages free). spend_limit must cover what this call starts, or nothing starts (limit_exceeded): the whole book (plan_book’s estimated_cost), or with a preview only the 2 preview pages (2 pages of balance for a storybook, 4 for a comic); approve_preview then needs its own spend_limit for the rest. Pages are charged as they are drawn. Storybooks and comics of 8+ pages draw the preview first (preview defaults to true) and wait for approve_preview. A plan with flags is refused until revise_plan fixes them. One plan makes one book: calling again with the same plan returns the same job (already_started, nothing spent). The account has an hourly limit on books started (every kind, through any connection or on colorcraft.ai; get_account shows it): past it, create_book is refused with rate_limited and retry_after_seconds (until the next hour). This connection’s caps (get_account’s credential.caps) refuse it too: with too_many_in_flight, active_job_ids and next_actions (get_job, approve_preview, cancel_book) while its books in progress at once are at the limit, or spend_cap_reached. plan_book and get_plan say so in can_create. Reuse idempotency_key to retry safely. Next: get_job; when done, generate_front_cover, export_cover_wrap, generate_listing and export_interior_pdf.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"plan_id": "<plan_id>",
"spend_limit": "<spend_limit>",
"idempotency_key": "<idempotency_key>"
},
"name": "create_book"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan_id | Yes | A ready plan_id from plan_book. | |
| preview | No | Storybook/comic only: draw 2 preview pages first and wait for approve_preview (default true for 8+ pages). | |
| spend_limit | Yes | The most pages of balance this call may use. The call is refused (limit_exceeded) when the estimate is higher. | |
| idempotency_key | Yes | A unique label for this request (e.g. a UUID, 8-120 characters). Reuse it, with the same arguments, to retry safely: a repeat never does the work twice and returns the first call’s result as it was then (its text says Replayed, and the result’s _meta has colorcraft/replayed: true and colorcraft/first_called_at, the first call’s time), not the current state; read that with get_job or get_project. The same key with different arguments is refused with idempotency_conflict (a different request needs a new idempotency_key), and so is a repeat after a first call that failed part-way (its message says what to check before a new key); while the first call is still running, a repeat answers busy with retry_after_seconds. A key is remembered per tool and per account: the same key sent to a different tool is a separate request, never a replay of or a conflict with the other tool’s. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | ||
| job_id | Yes | Book job handle: poll with get_job. | |
| plan_id | Yes | ||
| preview | Yes | True when the book starts (or started) with a preview that waits for approve_preview. | |
| warnings | Yes | ||
| book_cost | Yes | Pages of balance the whole book uses. | |
| project_id | Yes | ||
| pages_total | Yes | Pages to draw (puzzles for a puzzle book). Not the printed count: plan_book’s interior_pages. | |
| next_actions | Yes | ||
| estimated_cost | Yes | Pages of balance this call will use (the preview pages when preview is on; 0 when already_started). | |
| already_started | Yes | True when this plan had already started this book (nothing new was spent). |