Skip to main content
Glama
nkarasiak

QGIS MCP

by nkarasiak

Execute SQL

execute_sql

Run SQL queries across loaded QGIS layers. Reference layers by name, optionally create a new layer or return row results.

Instructions

SQL across loaded layers via a virtual layer; reference layers by name in FROM/JOIN. as_layer=True registers the result as a new layer (set geometry_field for spatial output); else returns rows inline (max 1000). layers limits sources by layer id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
layersNo
as_layerNo
uid_fieldNo
layer_nameNosql_result
geometry_fieldNo
Behavior3/5

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

Discloses that `as_layer=True` registers the result as a new layer (a mutation) and that non-layer mode returns at most 1000 rows. No annotations are provided, so the description carries the full burden; it covers key side effects but omits potential risks like write permissions or performance impacts.

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 sentences pack all essential information without redundancy. Every clause adds meaning: the virtual layer mechanism, parameter behavior, and constraints. No fluff.

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

Completeness2/5

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

With 6 parameters, no output schema, and no annotations, the description should be more thorough. It omits the purpose of `uid_field` and `layer_name`, and does not describe the return structure for inline rows. The agent lacks critical information for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains `query`, `layers`, `as_layer`, and `geometry_field`, but does not describe `uid_field` or `layer_name`. This partial coverage adds value but leaves gaps for 2 of 6 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?

Clearly states it executes SQL across loaded layers via a virtual layer, and distinguishes two modes: returning rows inline or creating a new layer. The verb 'execute' and resource 'SQL across loaded layers' is specific, and the description differentiates the tool from siblings that perform other operations.

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

Usage Guidelines3/5

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

Provides usage guidance for the `as_layer` parameter (when to create a new layer vs return rows) and mentions the `layers` parameter to limit sources. However, it does not compare this tool to alternatives like `evaluate_expression` or `execute_processing`, so the agent lacks context for when to choose this over siblings.

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/nkarasiak/qgis-mcp'

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