Skip to main content
Glama

Add linear gradient

add_linear_gradient

Define a directional color gradient in an SVG document by specifying color stops and optional vector endpoints, then apply it as a fill.

Instructions

Add a <linearGradient> to the document <defs> (created if absent).

When to use: defining a directional colour fade to paint with. For a centred/radial fade use add_radial_gradient; after defining, apply it via set_fill(doc_id, ids, "url(#grad-id)").

Key params: stops is a list of {offset, color, opacity?} (≥ 1): offset a 0..1 number or 0%..100% percentage, color a validated colour, optional opacity in [0, 1]. The vector runs (x1, y1) -> (x2, y2) (numbers or percentages; default a left-to-right sweep).

Return shape: CreateResultobject_id is the gradient id (use as url(#id) paint), bbox=None (a def, not a drawn shape), plus the pipeline fields.

Example: add_linear_gradient(doc_id, [{"offset": 0, "color": "#fff"}, {"offset": 1, "color": "#3366cc"}])

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 (reversible write-new on the working copy; original untouched).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
x1No0%
x2No100%
y1No0%
y2No0%
stopsYes
doc_idYes
object_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
bboxNo
doc_idYes
changedYes
summaryNo
object_idYes
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 (readOnlyHint=false, destructiveHint=false), description adds risk class 'medium (reversible write-new on working copy; original untouched)', advises rendering before trusting, and mentions restore_snapshot as revert option. This provides valuable behavioral context.

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

Conciseness5/5

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

Well-structured with clear sections: purpose, when-to-use, parameter details, return shape, example, and risk note. Every sentence adds value without being verbose.

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?

Complete for a gradient-adding tool: describes return shape (CreateResult with object_id and bbox=None), provides usage example, risk assessment, and verification steps. Output schema exists but description sufficiently explains output.

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?

With 0% schema description coverage, the description compensates by explaining stops parameter in detail (offset, color, opacity) and vector coordinates (x1,y1 to x2,y2) with defaults. Not every parameter is fully detailed (doc_id implied, object_id not mentioned), but the essential semantics are covered.

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 adds a <linearGradient> to the document <defs>, with a specific verb and resource. It distinguishes from sibling add_radial_gradient by explicitly contrasting usage.

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 (directional colour fade) and when not (centred/radial fade, recommending add_radial_gradient). Provides a usage example and mentions applying the gradient via set_fill, giving clear context for selecting this tool.

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