Skip to main content
Glama

haomeme_batch_generate

Generate up to 50 HaoMeme-style meme PNGs in one call by reusing a single browser session, so you can batch-render multiple captioned images without repeating setup.

Instructions

Generate 1..50 HaoMeme-style meme PNGs in ONE call, reusing a single headless-browser page — much faster than one haomeme_generate call per image (the browser and fonts load once). items = an array of spec objects, EACH accepting the same optional fields as haomeme_generate (full reference: FIELD_HELP below, or call haomeme_catalog once first for the live portrait keys). RULES THAT MATTER: (1) line breaks are written as the two characters backslash-n inside the JSON argument, e.g. "第一行\n第二行" — a literal newline can be dropped and your two captions will end up on one line; (2) lineColors is ONE colour per line (white|yellow|red), default white then yellow; (3) template teaches/crash put the portrait on the LEFT, nope puts it on the RIGHT. Example: [{"text":"第一行\n第二行","lineColors":["white","yellow"],"template":"teach","portrait":"A","backdrop":"red"},{"text":"A\nB","template":"nope","portrait":"I","backdrop":"dark"}]. A single bad item does NOT fail the batch: it returns {ok:false, index, error} and the rest still render. Returns {ok, count, succeeded, outputDir, results[]} where each result is {ok, path, bytes, width, height, template, text}. The first call may take ~20-60s while the browser starts; afterwards each item is fast. outputDir must stay inside the project folder (default ./output; override with HAOMEME_OUTPUT_ROOT).

FIELD REFERENCE (all optional, omitted = template default): HaoMeme spec fields — EVERY field is optional; an omitted field keeps that template's own default: text string, max 300 chars. The headline. To break a line write the two characters backslash-n ("\n") INSIDE the JSON argument, e.g. "第一行\n第二行". Do NOT rely on a literal line-break character in the JSON string: some clients drop it and the two captions collapse onto one line (and the filename loses the break too). Omit text to use the template preset listed below. template teach | crash | nope | sue (default: teach) lineColors array, max 8, ONE colour per line: white | yellow | red. Line 1 defaults to white, line 2 to yellow, any extra line to white. The colour is per LINE, not per character. portrait built-in portrait key (single letter, from haomeme_catalog's live list). Overrides portraitIndex. portraitIndex zero-based index into that portrait list (alternative to portrait). backdrop red | classroom | oldClassroom | room | grey | dark | smoke red = flat red with the paint stroke; the others are photo sets. side left | right — which side the portrait sits on. textSize 30..220 (100 = default, bigger = larger type) rotation -180..180 degrees of text rotation brushSize 30..250 (100 = default) — red paint-stroke thickness portraitSize 30..260 (100 = default) backgroundSize 10..300 (100 = default) backgroundBlur 0..30 px — blur on photo backdrops redBrush boolean — show the red paint stroke under the text brushInFront boolean — paint stroke in front of the portrait (still below the text) italic boolean — lean the text to the right flip boolean — mirror the portrait

LAYOUT (verified by actually rendering): teach and crash = portrait on the LEFT with the big headline on the right; nope = portrait on the RIGHT with the text on the left; sue = the lawyer-letter style. Use nope when you want the portrait and the text on opposite sides from teach/crash.

Preset text used when "text" is omitted: teach 輪到你\n教育我了? crash AI教育\n翻車了? nope 想玩GTA6?\n免談 sue 你準備收\n律師傳票

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": {
      "items": "<items>"
    },
    "name": "haomeme_batch_generate"
  }
}

Input Schema

NameRequiredDescriptionDefault
itemsYes1-50 meme specs (one object per meme). Each spec accepts the same optional fields as haomeme_generate — see the field reference above or in haomeme_catalog.
outputDirNoFolder inside this project; defaults to ./output. Paths outside the project root are rejected (set HAOMEME_OUTPUT_ROOT to change the root).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does well on failure semantics: a single bad item returns {ok:false, index, error} without failing the batch, and it discloses cold-start latency and the path-escape rejection. However, it never mentions permissions, whether existing files in outputDir are overwritten, or naming/filename behavior beyond an incidental remark about the filename losing the line break.

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

Conciseness2/5

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

The opening is well front-loaded with the rules that matter and a concrete example, but the description then reproduces the entire per-field reference verbatim from a schema that already documents 100% of fields, roughly doubling length with redundant content.

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?

No output schema exists, yet the description specifies the return shape {ok, count, succeeded, outputDir, results[]} and per-result fields {ok, path, bytes, width, height, template, text}, plus partial-failure and timing behavior. For a two-parameter batch tool this leaves nothing an agent needs unknown.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The FIELD REFERENCE section largely restates the schema's own field descriptions (text, lineColors, template, numeric ranges) rather than adding new meaning, and gets no extra credit for repetition.

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?

States a specific verb and resource ("Generate 1..50 HaoMeme-style meme PNGs") and immediately scopes it against the sibling: it reuses one headless-browser page and is "much faster than one haomeme_generate call per image." An agent can distinguish this from haomeme_generate without opening either schema.

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?

Explicitly routes usage: use this for multiple images in one call rather than one haomeme_generate per image, and "call haomeme_catalog once first for the live portrait keys." It also states the outputDir constraint (must stay inside the project folder) and the timing expectation (~20-60s first call), giving the agent enough to decide when to invoke it.

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