Skip to main content
Glama

Set document SVG

set_document_svg
DestructiveIdempotent

Replace the entire SVG document with a provided SVG string. Use for adopting a full SVG composed in memory without file round-trip.

Instructions

REPLACE the whole working copy with an agent-composed SVG string (root must be <svg>).

When to use: adopting a full SVG composed in memory, replacing the working copy wholesale (no file round-trip). To ADD to (not replace) a document use insert_svg_fragment; for a blank start use create_document.

Key params: svg root must be <svg>; it is byte-size-checked, safe-parsed, and allowlist-scrubbed — <script>, any on* handler, javascript: hrefs, and external refs (http(s):// / // / file: / data:) are REJECTED; only a same-document #id reference is allowed. A real run REQUIRES a non-empty approval_token. The original/source file is never touched.

Return shape: ComposeResult — an EditResult (operation + pre-mutation snapshot links, reversible via restore_snapshot) extended with the post-adopt validate_document findings (validation).

Example: set_document_svg(doc_id, "<svg ...>...</svg>", approval_token="ok")

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: HIGH — requires a non-empty approval_token; without it the op is refused and nothing is written.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
svgYes
doc_idYes
approval_tokenNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes
changedYes
summaryNo
validationYesStructured, machine-readable validation result for one document. `ok` is True iff there are no `error`-severity findings. `error_count` / `warning_count` are convenience tallies over `findings`.
snapshot_idYes
operation_idYes
preview_afterNo
preview_beforeNo
Behavior5/5

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

Beyond annotations (idempotentHint=true, destructiveHint=true), description adds critical details: security scrubbing (rejects scripts, handlers, external refs), requirement for non-empty approval_token, that original file is untouched, return shape, and advice to preview and restore if wrong. No contradiction with annotations.

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 clear sections: purpose, when to use, key params, return shape, example, risk class. Front-loaded with core action. Slightly lengthy but every sentence adds value. Could be trimmed marginally.

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 tool complexity (destructive, idempotent, 3 params, output schema), description covers all needed context: purpose, alternatives, security constraints, required token, return shape, example, risk level, and preview advice. No gaps identified.

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 has 0% description coverage, so description must compensate. It explains svg must be <svg> root and lists security constraints, and clarifies approval_token must be non-empty for execution. Doc_id is not explained, but it's a common parameter. Overall adds significant meaning beyond schema for most parameters.

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 clearly states the action as REPLACE the whole working copy with an agent-composed SVG string, distinguishing it from sibling tools insert_svg_fragment (add) and create_document (blank start).

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 when-to-use: adopting a full SVG composed in memory, replacing wholesale. Explicit alternatives: insert_svg_fragment for addition, create_document for blank start. Provides clear context and 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