Skip to main content
Glama

Fit canvas to content

fit_to_content

Adjust the document's viewBox to tightly fit the content bounding box, cropping the page to frame the drawing exactly.

Instructions

Fit the document's root viewBox to its CONTENT bounding box.

When to use: cropping the page so it frames the drawing exactly. To set an explicit page size use resize_canvas, to merely repair the viewBox use normalize_viewbox.

Key params: none beyond doc_id. The content bbox is computed by the Inkscape engine (--query-all, ADR-005 — real geometry, not naive XML) in the document's intrinsic user-coordinate space (probed against a px-identity copy so the value is STABLE across calls); only the root viewBox changes. IDEMPOTENT: a second call on an already-fitted document reports changed=False. Fails with a stable error if the engine is unavailable, the document has no drawable content, or the bbox is degenerate.

Return shape: EditResultoperation_id, snapshot_id, changed (real before/after content diff), before/after preview; the edit lands on the working copy only (reversible).

Example: fit_to_content(doc_id)

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
doc_idYes
changedYes
summaryNo
snapshot_idYes
operation_idYes
preview_afterNo
preview_beforeNo
Behavior1/5

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

The description claims idempotency ('IDEMPOTENT: a second call ... reports changed=False'), but the annotation sets idempotentHint=false, creating a direct contradiction. This is a critical failure and override any positive behavioral disclosures.

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?

The description is well-structured with sections (purpose, when to use, key params, behavior, return shape, example, warning) and front-loads the core purpose. It is slightly verbose when repeating return shape details, but overall efficient for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the idempotency contradiction, the description covers usage, behavior, error cases, and a warning. With an output schema existing, it provides ample context for a one-parameter tool. The contradiction slightly undermines completeness, but the description is otherwise thorough.

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?

The input schema has 0% description coverage, so the description must compensate. It clearly states 'Key params: none beyond doc_id', identifying the sole parameter and implying no others. While it doesn't detail doc_id's format, the context of a single required parameter makes it adequate. Baseline for 0 params is 4, and this fits.

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 tool's action: 'Fit the document's root viewBox to its CONTENT bounding box.' It uses a specific verb and resource, and distinguishes from siblings like resize_canvas and normalize_viewbox by explicitly contrasting use cases.

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?

The description provides explicit guidance on when to use this tool (cropping the page to frame the drawing) and when to use alternatives (resize_canvas for explicit page size, normalize_viewbox for repairing viewBox). This leaves no ambiguity for the agent.

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