Skip to main content
Glama

haomeme_generate

Generates a 1280×720 HaoMeme-style meme PNG in your project folder from a JSON spec, rendering through a headless browser so fonts, portraits, paint strokes, and layout match the web UI.

Instructions

Generate ONE HaoMeme-style meme PNG (1280x720) into this project folder. Renders by driving the original HaoMeme web app in a local headless browser, so fonts, built-in portraits, paint stroke and layout match the web UI exactly. spec = one object of optional fields (full reference: FIELD_HELP below, or call haomeme_catalog). 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: {"template":"teach","portrait":"A","backdrop":"red","text":"老黃說退就退\n#OpenToWork","lineColors":["white","yellow"]}. outputDir must stay inside the project folder (default ./output; override with HAOMEME_OUTPUT_ROOT). Returns {ok, path, bytes, width, height, template, text}; a failure is returned as {ok:false, error}. For 2+ images prefer haomeme_batch_generate — one browser page is reused and it is much faster.

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": {
      "spec": "<spec>"
    },
    "name": "haomeme_generate"
  }
}

Input Schema

NameRequiredDescriptionDefault
specYes
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.6/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full burden and does well: it discloses the headless-browser rendering path, the exact return shape {ok, path, bytes, width, height, template, text} and the failure shape {ok:false, error}, and the outputDir containment rule with the HAOMEME_OUTPUT_ROOT override. It stops short of stating overwrite/collision behavior, execution time, or concurrency limits, which keeps it off a 5.

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

Conciseness3/5

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

Structure is good — critical rules and an example are front-loaded before the reference block — but the same information is stated two to three times: the backslash-n line-break rule appears in RULES, in the FIELD REFERENCE, and again in the schema's text field; the portrait left/right layout is repeated in RULES item 3, the LAYOUT section, and the template field. The 300-char-max and range values largely restate the schema.

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?

For a tool with a nested 2-parameter schema, no output schema, and no annotations, this is complete: it names the return contract, the failure contract, the output path constraint, the escaping pitfall, template defaults and presets, and the batch alternative for scale.

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

Parameters5/5

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

Schema coverage is only 50% and nested, but the description supplies a complete FIELD REFERENCE with defaults, ranges, enumerations, and cross-field interactions the schema does not state (portrait overrides portraitIndex; lineColors is per line, not per character; omitted text falls back to a per-template preset). The backslash-n escaping rule and a concrete worked example add capability the schema cannot express.

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 artifact (generate ONE HaoMeme-style meme PNG at 1280x720) plus the rendering mechanism, which distinguishes it from haomeme_batch_generate (2+ images) and haomeme_catalog (field/portrait reference). An agent can identify the resource and scope without opening the 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?

Explicit routing: 'For 2+ images prefer haomeme_batch_generate — one browser page is reused and it is much faster,' plus 'call haomeme_catalog' for the full field reference. It also gives selection guidance among templates (use nope when you want the portrait and text on opposite sides from teach/crash).

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