Skip to main content
Glama
nkarasiak

QGIS MCP

by nkarasiak

Apply Style QML

apply_style_qml

Apply a QML style to a layer from a file or inline text, enabling rule-based renderers, data-defined properties, SVG fills, and blend modes. Invalid styles are rejected and prior style restored.

Instructions

Apply a QGIS QML style to a layer, from a file (path) or inline QML text (qml); pass exactly one. Use it for styles the other styling tools do not model (rule-based renderers, data-defined properties, SVG fills, blend modes). Rejected, with the previous style restored, if the XML is malformed, targets the other layer kind, or QGIS loads a different renderer than the QML declares. Tip: save_style_qml on a similar layer gives a template in this QGIS version's format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qmlNo
pathNo
layer_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.15.0
    • addedInput schema / properties / path / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / path / default
      Added value: +null
    • removedInput schema / properties / path / type
      Removed value: -"string"
    • addedInput schema / properties / qml
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • changedInput schema / required
      Previous value: -[
      -  "layer_id",
      -  "path"
      -]New value: +[
      +  "layer_id"
      +]
  2. Addedv0.5.0
  3. Removed
  4. First observedv0.3.0

TDQS

A4.4/5.0
Behavior4/5

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

No annotations exist, so the description carries full burden. It discloses rejection conditions (malformed XML, wrong layer kind, renderer mismatch) and that the previous style is restored on failure. Could add details about success response or side effects but covers key behavior.

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?

Two dense sentences plus a tip, all front-loaded with purpose and constraints. Every sentence contributes value with no fluff.

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?

Covers input methods, use case, failure modes, and template tip. No output schema means return value isn't described, but for a style-apply operation the success/failure behavior is well implied. Slightly more detail on the result (e.g., applied style confirmation) would round it out.

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 coverage is 0%, but the description explains that qml is inline text and path is a file path, and that exactly one must be passed. This adds meaning beyond the bare schema, compensating for the low coverage.

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?

Clearly states it applies a QGIS QML style to a layer, distinguishes from siblings by noting it handles styles other tools don't model (rule-based, data-defined, SVG fills, blend modes). Verb+resource+scope are specific and actionable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says to use it for styles the other styling tools do not model, which implies when not to use it. Mentions a tip about save_style_qml as a template source but doesn't name the alternative styling tools directly, leaving some inference.

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

Deploy Server

Other Tools