Skip to main content
Glama
yo-1
by yo-1

execute_code

Run Python code inside a live QGIS session to access iface and project objects, set a result, and test plugin behavior after enabling the exec opt-in.

Instructions

Execute arbitrary Python inside QGIS (iface, project in scope; set result). Requires the exec opt-in.

Input Schema

NameRequiredDescriptionDefault
codeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses arbitrary Python execution, available QGIS objects, the result variable, and the exec opt-in requirement, but omits side-effect, failure, and return-channel details important for code execution.

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?

A single compact sentence front-loads the action and packs scope, result handling, and the opt-in prerequisite without wasted words.

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?

The description covers the essential invocation context and result assignment, but for a dangerous arbitrary-code tool with no annotations and no output schema, it lacks detail on return behavior, errors, and side effects.

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%, so the description must compensate, and it does: it clarifies that code is Python executed inside QGIS with iface and project in scope and that the code should assign result. That adds substantial meaning beyond the bare string parameter.

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 arbitrary Python inside QGIS, with explicit execution scope (iface, project). It is clearly distinct from algorithm/recipe tools, though it does not name those siblings explicitly.

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?

Mentions a prerequisite (exec opt-in), which implies this tool is for environments where that permission is enabled. However, it does not state when to prefer this over safer siblings such as run_recipe or run_algorithm.

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