Skip to main content
Glama

Compose grid

compose_grid

Arrange multiple SVG documents or objects into a grid layout in a single call, with automatic scaling and cell spacing. Creates a new document or inserts into an existing one, fully reversible.

Instructions

Lay out N DIFFERENT assets in a grid (contact / spec sheet) in ONE reversible call.

When to use: building a multi-asset sheet — one cell per DIFFERENT document or object — in a single call (no per-asset loop, no lxml subtree extract). To repeat ONE object into a grid use tile; to graft a single composed subtree use insert_svg_fragment.

Key params: supply EXACTLY ONE source mode — doc_ids (one whole document per cell) OR object_ids together with source_doc_id (objects from one document per cell). The grid fills ROW-MAJOR over rows x cols cells of size cell (user units); fewer assets than cells leaves trailing cells empty. Each asset is deep-copied (every id re-minted, intra-clone refs rewritten, no id clashes), wrapped in a <g> translated to its cell origin and, with scale_to_fit (default True), uniformly DOWN-scaled to fit cell - 2*padding (never upscaled). gap/padding (default 0) space the cells. target_doc_id composes INTO an existing document; omit it to create a new blank document sized to the whole grid. Bounded: rows*cols ≤ the engine cell cap; the asset count must not exceed the cell count.

Return shape: ComposeGridResult — an EditResult (one operation_id + one pre-mutation snapshot for the whole sheet, reversible via restore_snapshot) plus target_doc_id (the new id when a blank doc was created), rows/cols, and cells (the ordered placement plan: per asset its grid coords, new cell-group id, and a short source label).

Example: compose_grid(3, 4, 64, doc_ids=["d1","d2",...,"d12"]) lays a 12-icon system into a 3x4 sheet in one call.

Render and look before you trust this edit: render with render_preview (or live_render_view) and inspect the result before relying on it; restore_snapshot reverts it if it is wrong.

Risk class: medium (creates a new tracked document or composes into one; sources never mutated).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gapNo
cellYes
colsYes
rowsYes
doc_idsNo
paddingNo
object_idsNo
scale_to_fitNo
source_doc_idNo
target_doc_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
colsYes
rowsYes
cellsYes
doc_idYes
changedYes
summaryNo
snapshot_idYes
operation_idYes
preview_afterNo
target_doc_idYes
preview_beforeNo
Behavior5/5

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

Discloses deep-copy, scaling behavior, grid fill order, cell bound, reversibility, risk class; annotations are minimal so description carries full burden and excels.

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?

Well-structured with sections (purpose, when to use, key params, return, example, caution). Slightly verbose but every sentence adds value; no fluff.

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?

Given complexity (10 params, output schema exists), description covers purpose, usage, behavior, parameter semantics, return shape, and risk. Output schema handles return details.

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?

Adds meaning beyond schema: explains source mode (doc_ids vs object_ids+source_doc_id), scale_to_fit default, gap/padding, target_doc_id. With 0% schema coverage, description compensates well but not every param is detailed.

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?

Specifies verb 'compose', resource 'grid of different assets', scope 'one reversible call', and distinguishes from siblings 'tile' and 'insert_svg_fragment'.

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 states when to use (multi-asset sheet) and when not (use 'tile' for repeating one object, 'insert_svg_fragment' for single subtree), plus key param guidance.

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/jjjsood/inkscape-mcp-server'

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