Skip to main content
Glama

run_pyqgis

Execute PyQGIS code inside a running QGIS session to automate layer management, project operations, map exports, and processing tasks.

Instructions

Execute PyQGIS code inside the running QGIS session. Variables: iface, project, QgsProject, qgis. Print output is returned; assign to result to return a value. / PyQGIS კოდის შესრულება QGIS-ში.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.2/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden. It usefully discloses the execution output contract (print output returned, assign to `result`) and the injected variables (iface, project, QgsProject, qgis), but says nothing about the fact that arbitrary code runs unsandboxed with write access to the live session and project data.

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?

Two tight sentences with the essential scope statement front-loaded. The appended Georgian translation duplicates the same content without adding meaning, which is the only wasted space.

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

Completeness3/5

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

For a one-param arbitrary-code-execution tool with no annotations and no output schema, the description covers the variable environment and return mechanism but leaves out side-effect and safety context. Adequate but with a clear gap given the tool's risk profile.

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 coverage is 0%, so the single `code` parameter is undocumented in the schema. The description partially compensates by explaining which variables are in scope and how to return a value, which genuinely clarifies what to put in `code`, but omits format or length constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — execute PyQGIS code — and scopes it to 'the running QGIS session', which implicitly separates it from the headless_command and headless_algorithm siblings. It stops short of naming those alternatives, so the differentiation is inferred rather than stated.

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

Usage Guidelines2/5

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

No when-to-use guidance is given. With siblings like headless_command and headless_algorithm in the toolset, the agent gets no signal for choosing live-session execution over a headless path, nor any prerequisites (e.g. project must be open).

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