luiccian-qgis-mcp

v0.1.1
luiccian-qgis-mcp Checked 2 days ago Published 19 days ago

QGIS MCP - control QGIS through the Model Context Protocol

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

ping Ping

Check connectivity to the QGIS plugin server. Returns pong if connected.

diagnose Diagnose

Run diagnostic checks on the QGIS MCP stack. Reports QGIS version, plugin/server version match, processing providers, connected clients, and project status.

list_qgis_instances List QGIS Instances

List the configured QGIS instances: name, host, port, reachability, and - for each reachable one - which QGIS actually answered (version, process id, window title, profile). Use it to confirm a name maps to the window you mean before writing to it. Pass a name as the 'instance' argument of any other tool to target that QGIS window; omitting it targets the instance named 'default', or the first one listed when no instance is called 'default'.

get_qgis_info Get QGIS Info

Get QGIS version, profile path, and plugin count.

get_project_info Get Project Info

Get current project metadata: filename, title, CRS, layer count, and summary of layers.

load_project Load Project

Load a QGIS project from a .qgs/.qgz file path. Replaces the open project; unsaved changes to it are lost. Layers whose source is missing are kept as unavailable and listed in 'unavailable_layers'.

ParameterTypeDescription
path *string

create_new_project Create New Project

Create a new empty QGIS project and save it to the given path. Replaces the open project; unsaved changes to it are lost.

ParameterTypeDescription
path *string

save_project Save Project

Save the current project. Optionally specify a new path.

ParameterTypeDescription
path

create_checkpoint Create Checkpoint

Snapshot the whole project (layers, styles, labels, layouts, map themes, variables, and the features of memory layers) so restore_checkpoint can return to it. Take one before a sequence of changes you may want to undo. The user's project file is not touched. Data in files and databases is not copied, and uncommitted edits are listed under 'uncommitted_edits' because the checkpoint does not hold them. The last 20 are kept, until the plugin's server stops.

ParameterTypeDescription
name

list_checkpoints List Checkpoints

List the project checkpoints: id, name, creation time, layer count.

restore_checkpoint Restore Checkpoint

Put the project back as it was at a checkpoint: every change since, and any uncommitted edit, is discarded. The project keeps its file name and is left unsaved. Memory layer features come back with new feature ids. Layers whose source is missing are kept as unavailable and listed in 'unavailable_layers'. export_session afterwards replays the restored state, not the undone steps.

ParameterTypeDescription
checkpoint_id *string

export_session Export Session Script

Every command that changed something in this QGIS since the plugin's server started (read-only calls left out), as a Python script that replays them from the QGIS Python console. Layer ids are remapped on replay. Returns the script, or writes it to 'path' and returns the path. clear: start a new journal afterwards. Commands from every connected client are in it; a restore_checkpoint rewinds it.

ParameterTypeDescription
clearboolean
path

get_layers Get Layers

List layers in the current project with IDs, names, types, visibility, and type-specific info. Use limit/offset for pagination. Response includes total_count.

ParameterTypeDescription
limitinteger
offsetinteger

add_vector_layer Add Vector Layer

Add a vector layer (shapefile, GeoJSON, GeoPackage, etc.) to the project.

ParameterTypeDescription
path *string
name
providerstring

add_raster_layer Add Raster Layer

Add a raster layer (GeoTIFF, etc.) to the project.

ParameterTypeDescription
path *string
name
providerstring

remove_layer Remove Layer

Remove a layer from the project by its layer ID. This is irreversible.

ParameterTypeDescription
layer_id *string

find_layer Find Layer

Find layers by name pattern. Supports fnmatch wildcards (e.g. 'roads*') and substring matching.

ParameterTypeDescription
name_pattern *string

create_memory_layer Create Memory Layer

Create a new in-memory vector layer. geometry_type: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon. fields: [{name, type}] where type is integer, double, string, date, datetime.

ParameterTypeDescription
geometry_type *string
name *string
crsstring
fields

add_web_layer Add Web Layer

Add a web layer (XYZ, WMS, WFS) to the project. service: 'xyz', 'wms', 'wfs'. crs is optional and only meaningful for wms ('crs=' in the uri) and wfs ('srsname='): leave it unset to take whatever the service serves natively. XYZ tiles are always EPSG:3857, so requesting another CRS for them is an error rather than a silent no-op. The response reports the CRS the layer actually got.

ParameterTypeDescription
service *string
url *string
crs
name

add_table_join Add Table Join

Add a table join to a vector layer.

ParameterTypeDescription
join_field *string
join_layer_id *string
target_field *string
target_layer_id *string
prefixstring

duplicate_layer Duplicate Layer

Duplicate a layer (including its style) under a new name.

ParameterTypeDescription
layer_id *string
new_name

set_layer_visibility Set Layer Visibility

Set a layer's visibility in the layer tree (show/hide on map).

ParameterTypeDescription
layer_id *string
visible *boolean

zoom_to_layer Zoom to Layer

Zoom the map canvas to the full extent of the specified layer.

ParameterTypeDescription
layer_id *string

get_layer_features Get Layer Features

Get features from a vector layer. Flat dicts: _fid + attributes at top level. expression filter (QGIS, e.g. "name = 'Berlin'", "population > 1000000"), limit (max 50, larger is refused; default 10), offset for paging, optional geometry in _geometry key. feature_count is the layer total; matched is the count after the expression filter.

ParameterTypeDescription
layer_id *string
expression
include_geometryboolean
limitinteger
offsetinteger

get_field_statistics Get Field Statistics

Compute aggregate statistics (count, sum, mean, min, max, stdev) for a numeric field. For non-numeric fields returns count and distinct values.

ParameterTypeDescription
field_name *string
layer_id *string

execute_sql Execute SQL

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, capped by limit (default 1000, negative for all) with a truncated flag. layers limits sources by layer id.

ParameterTypeDescription
query *string
as_layerboolean
geometry_field
layer_namestring
layers
limitinteger
uid_field

identify_features Identify Features

Identify features at a point [x, y] across layers (map-click analogue). The point and tolerance are in crs when given, else the project CRS; layers in another CRS are reprojected. tolerance (in those units) expands the search; 0 = exact hit. layer_ids limits the search (default: visible vector layers). limit caps features per layer. Layers the point cannot be transformed into are listed in skipped_layers.

ParameterTypeDescription
point *array
crs
layer_ids
limitinteger
tolerancenumber

add_features Add Features

Add features to a vector layer. Each feature: {attributes: {field: value}, geometry_wkt: 'POINT(1 2)'}. geometry_wkt is in the layer's CRS, or in crs when given (it is then reprojected). A geometry type the layer cannot hold is refused; invalid geometry or 2D on a Z layer comes back in warnings. Returns count of added features.

ParameterTypeDescription
features *array
layer_id *string
crs

update_features Update Features

Update feature attributes. updates: [{fid: 1, attributes: {field: value}}]. Returns count of updated features.

ParameterTypeDescription
layer_id *string
updates *array

delete_features Delete Features

Delete features by feature IDs or expression filter. Provide either fids (list of ints) or expression (string), not both. Returns requested and the measured deleted count.

ParameterTypeDescription
layer_id *string
expression
fids

update_feature_geometry Update Feature Geometry

Replace feature geometries. updates: [{fid: 1, geometry_wkt: 'POINT(1 2)'}]. WKT must be in the layer's CRS. Inside an edit session the change is undoable; otherwise it is written straight to the data source.

ParameterTypeDescription
layer_id *string
updates *array

add_field Add Field

Add a new field to a vector layer. field_type: 'string', 'int', 'double', 'bool', 'date', 'datetime'.

ParameterTypeDescription
field_name *string
field_type *string
layer_id *string
length
precision

delete_field Delete Field

Delete a field from a vector layer.

ParameterTypeDescription
field_name *string
layer_id *string

rename_field Rename Field

Rename a field in a vector layer.

ParameterTypeDescription
layer_id *string
new_name *string
old_name *string

start_editing Start Editing

Open an edit session on a vector layer. Subsequent add/update/delete calls go to the undoable edit buffer instead of the data source, until commit_edits or rollback_edits.

ParameterTypeDescription
layer_id *string

commit_edits Commit Edits

Commit the layer's edit buffer to the data source and close the edit session.

ParameterTypeDescription
layer_id *string

rollback_edits Rollback Edits

Discard every uncommitted change on a layer and close the edit session.

ParameterTypeDescription
layer_id *string

get_edit_status Get Edit Status

Edit state of a layer: editable, modified, undo/redo availability, and the counts of pending added/deleted/changed features.

ParameterTypeDescription
layer_id *string

undo_edits Undo Edits

Undo the last edit operations on a layer (its own undo stack). Returns how many steps were actually undone.

ParameterTypeDescription
layer_id *string
stepsinteger

redo_edits Redo Edits

Redo previously undone edit operations on a layer.

ParameterTypeDescription
layer_id *string
stepsinteger

select_features Select Features

Select features in a layer by expression or feature IDs.

ParameterTypeDescription
layer_id *string
expression
fids

get_selection Get Selection

Get the current selection for a layer. Returns feature IDs and count.

ParameterTypeDescription
layer_id *string

clear_selection Clear Selection

Clear the selection on a layer.

ParameterTypeDescription
layer_id *string

set_layer_style Set Layer Style

Set symbology. style_type: 'single' (one symbol), 'categorized' (unique values), 'graduated' (numeric ranges). field required for categorized/graduated. color_ramp: QGIS ramp name (e.g. 'Spectral', 'Viridis', 'Blues'). classes: graduated class count (default 5). opacity: layer opacity from 0.0 to 1.0 (default 1.0). color: optional symbol color (hex like '#ff0000' or color name, for single style). size: optional marker size or line width (>0).

ParameterTypeDescription
layer_id *string
style_type *string
classesinteger
color
color_rampstring
field
opacitynumber
size

set_raster_style Set Raster Style

Set raster symbology. style_type: 'singleband_pseudocolor' (color ramp over one band), 'singleband_gray', 'multiband_color' (RGB), 'hillshade'. min_value/max_value default to the band statistics. color_ramp: QGIS ramp name (e.g. 'Viridis', 'Spectral', 'RdYlGn'). classification: continuous|equal_interval|quantile. interpolation: interpolated|discrete|exact. gradient (gray): black_to_white|white_to_black. contrast: none|stretch|clip|stretch_clip. hillshade uses band, azimuth, altitude, z_factor.

ParameterTypeDescription
layer_id *string
style_type *string
altitudenumber
azimuthnumber
bandinteger
blue_bandinteger
classesinteger
classificationstring
color_rampstring
contraststring
gradientstring
green_bandinteger
interpolationstring
max_value
min_value
red_bandinteger
z_factornumber

apply_style_qml Apply Style QML

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.

ParameterTypeDescription
layer_id *string
path
qml

save_style_qml Save Style QML

Save a layer's style to a QGIS QML file.

ParameterTypeDescription
layer_id *string
path *string

get_canvas_extent Get Canvas Extent

Get the current map canvas extent and CRS.

set_canvas_extent Set Canvas Extent

Set the map canvas extent. Coordinates should be in the specified CRS (default: project CRS).

ParameterTypeDescription
xmax *number
xmin *number
ymax *number
ymin *number
crs

get_canvas_screenshot Get Canvas Screenshot

Grab a fast screenshot of the current map canvas widget (no re-render). Returns the image inline. Much faster than render_map.

get_3d_screenshot Get 3D Screenshot

Capture an OPEN 3D Map View as an inline image. Reuses the open view's scene + camera, rendered via a print-layout 3D map item (the 2D get_canvas_screenshot cannot capture the OpenGL 3D view). Requires a 3D map view to be open in QGIS (View > 3D Map Views > New 3D Map View). view_index selects which view when several are open; dpi controls output resolution. Optional camera overrides (applied to the capture only, leaving the live view unchanged): pitch (0 = straight down/top-down, 90 = horizontal/edge-on; ~45 = balanced oblique), heading (compass degrees), distance (metres).

ParameterTypeDescription
distance
dpiinteger
heading
pitch
view_indexinteger

get_raster_info Get Raster Info

Get raster layer info: band count, dimensions, CRS, extent, per-band statistics, nodata values.

ParameterTypeDescription
layer_id *string

execute_processing Execute Processing

Execute a QGIS Processing algorithm. Use get_algorithm_help to discover parameters. Layer params accept layer IDs or file paths. Set OUTPUT to 'memory:' for temp layers. timeout: seconds before the algorithm is cancelled (default 55). Raise it for heavy raster work, or use start_processing_job, which runs in the background with no limit. load_results: add the algorithm's outputs to the project and list them in 'loaded_layers' (the processing.runAndLoadResults() behaviour). This is the only way to keep a 'TEMPORARY_OUTPUT'/'memory:' result, which is otherwise discarded when the run ends. Only v…

ParameterTypeDescription
algorithm *string
parameters *object
ellipsoid
load_resultsboolean
timeout

start_processing_job Start Processing Job

Run a Processing algorithm as a QGIS background task, with no time limit, and return its job id at once. QGIS stays usable while it runs. Poll get_processing_job for progress and the result; cancel_processing_job stops it. Use it instead of execute_processing for anything that may take more than a minute. Same parameters as execute_processing. A 'TEMPORARY_OUTPUT'/'memory:' vector (feature sink) output needs load_results=True, since that memory layer ends with the job; temporary files stay on disk. Algorithms that must run on QGIS's main thread are refused: use execute_processing for those.

ParameterTypeDescription
algorithm *string
parameters *object
ellipsoid
load_resultsboolean

get_processing_job Get Processing Job

State of a background job: 'running' (with progress 0-100), 'succeeded' (with result, loaded_layers and warnings, as execute_processing returns them), 'failed' (with error) or 'cancelled'. Omit job_id to list every job.

ParameterTypeDescription
job_id

cancel_processing_job Cancel Processing Job

Ask a running background job to stop. Its state turns 'cancelled' once QGIS has stopped it; outputs it already wrote stay on disk.

ParameterTypeDescription
job_id *string

list_processing_algorithms List Processing Algorithms

Search for processing algorithms by keyword and/or provider. Returns id, name, provider for each match.

ParameterTypeDescription
provider
search

get_algorithm_help Get Algorithm Help

Get detailed help for a processing algorithm: parameters (name, type, optional, default), outputs, and description.

ParameterTypeDescription
algorithm_id *string

get_processing_providers Get Processing Providers

List Processing providers (native, gdal, grass, saga, model, ...) with algorithm counts and active status. Use to diagnose missing algorithms.

execute_processing_batch Execute Processing Batch

Run one algorithm once per parameter dict in 'parameters_list'. Returns a per-run result with index and success/error status. Use for applying the same operation over many inputs in a single round-trip. timeout: seconds for the whole batch (default 55); runs that would start after it has elapsed come back as 'skipped' with the completed ones intact, so raise it or split the list for big batches. ellipsoid: measurement ellipsoid for every run (e.g. 'EPSG:7030'); default is the project's.

ParameterTypeDescription
algorithm *string
parameters_list *array
ellipsoid
timeout

create_processing_model Create Processing Model

Build QGIS Processing Model (.model3) from structured spec; save to user models folder, register in Processing Toolbox. Only call needed: algorithm discovery + param validation run in the plugin against the live registry, so do NOT call list_processing_algorithms or get_algorithm_help first. Pass keyword ('buffer') or full id ('native:buffer'); handler resolves it. Ambiguous hint returns candidate list to refine and retry. Bad param/output names reported with the valid set. Spec: inputs: [{name, type, description?, default?, optional?, parent_layer? (for field/distance), options? (for enum)…

ParameterTypeDescription
name *string
steps *array
descriptionstring
groupstring
inputs
outputs

list_processing_models List Processing Models

List registered Processing models (the 'model' provider). Returns id, name, group for each. Use run_model to execute one.

run_model Run Model

Run a Processing model by registered id (e.g. 'model:myflow') or by a .model3 file path. 'parameters' maps the model's input names to values (layer ids/paths, numbers, etc.). ellipsoid: ellipsoid for distance/area measurements (e.g. 'EPSG:7030' for WGS 84, 'NONE' for planimetric); default is the project's.

ParameterTypeDescription
model *string
ellipsoid
parameters

raster_calculator Raster Calculator

Band math via the QGIS raster calculator. Reference loaded raster layers in the expression as 'LayerName@band' (e.g. '("dem@1" > 1000) * 1'). Writes a GeoTIFF to output_path. Output grid, extent and CRS taken from reference_layer (layer id or name), defaulting to the first loaded file-based raster.

ParameterTypeDescription
expression *string
output_path *string
reference_layer

zonal_statistics Zonal Statistics

Per-polygon stats from a raster (native:zonalstatisticsfb). stats int codes: 0=count 1=sum 2=mean 3=median 4=stdev 5=min 6=max 7=range 8=minority 9=majority 10=variety 11=variance (default [0,1,2]). New columns prefixed by 'prefix'. No output_path = in-memory layer.

ParameterTypeDescription
polygon_layer *string
raster_layer *string
bandinteger
output_path
prefixstring
stats

sample_raster_values Sample Raster Values

Sample raster pixel values at points. 'points' is a list of [x, y] in crs when given (reprojected to the raster), else in the raster's CRS. Omit 'band' to sample all bands. A null value is nodata when outside_extent is false; outside_extent true means the point is off the raster (often a CRS mix-up); transform_failed marks a point the raster's CRS cannot express.

ParameterTypeDescription
points *array
raster_layer *string
band
crs

export_layer Export Layer

Export vector/raster to disk; format from output_path extension (.gpkg, .shp, .geojson, .tif, ...). target_crs (e.g. 'EPSG:4326') reprojects on export. filter_expression (vector only) exports a subset matching a QGIS expression.

ParameterTypeDescription
layer_id *string
output_path *string
filter_expression
target_crs

field_calculator Field Calculator

Add (if missing) + populate a field from a QGIS expression, per feature, in-place. field_type: string|int|double|bool|date|datetime (default double). Example: expression='$area', field_name='area'. $area/$length use the project's ellipsoid and units (reported back as 'measurement'), not necessarily m2/m; the area()/length() functions are planimetric in the layer CRS (measurement.planimetric_units, squared for area()); length() of a string counts characters and reports no units. Returns updated and failed counts; failed features keep their old value and first_error says why. Refused while the l…

ParameterTypeDescription
expression *string
field_name *string
layer_id *string
field_typestring
lengthinteger
precisioninteger

get_unique_values Get Unique Values

Return the distinct values of a field. Use 'limit' to cap results (-1 for all). Useful before building categorized symbology or filters.

ParameterTypeDescription
field *string
layer_id *string
limitinteger

spatial_join Spatial Join

Join attributes by location (native:joinattributesbylocation). predicates int list: 0=intersects 1=contains 2=equals 3=touches 4=overlaps 5=within 6=crosses (default [0]). method: 0=one-to-many 1=first match (default) 2=largest overlap. First match keeps one arbitrary match per target feature and drops the others; use 0 when several can match. join_fields = copied columns (default all). No output_path = in-memory layer. Returns joined_count (target features that found a match, whatever the method) next to target_features. warnings/warning_count report features QGIS skipped, e.g. invalid geomet…

ParameterTypeDescription
join_layer *string
target_layer *string
join_fields
methodinteger
output_path
predicates
prefixstring

render_map Render Map

Render the current map canvas to an image. Returns the image inline so you can see it. Optionally saves to a file path on disk.

ParameterTypeDescription
heightinteger
path
widthinteger

execute_code Execute Code

Execute arbitrary PyQGIS code. Use for operations not covered by other tools. Has access to QgsProject, iface, and core QGIS classes. Returns stdout/stderr and elapsed seconds. timeout: seconds before the script is cancelled (default 55); a script that runs past it comes back with timed_out=True and the output printed so far, and its side effects stand. Raise timeout or split bulk work into several calls; QGIS is unresponsive while a script runs. A single blocking call (time.sleep, GDAL) cannot be interrupted before it returns. A script that raises or times out is a tool error carrying the tra…

ParameterTypeDescription
code *string
timeout

get_active_layer Get Active Layer

Get the currently active (selected) layer in the QGIS layer panel.

set_active_layer Set Active Layer

Set the active layer in the QGIS layer panel by layer ID.

ParameterTypeDescription
layer_id *string

get_canvas_scale Get Canvas Scale

Get the current map canvas scale, rotation, and magnification factor.

set_canvas_scale Set Canvas Scale

Set the map canvas scale and/or rotation. Provide scale as denominator (e.g. 50000 for 1:50000). Rotation in degrees (0-360).

ParameterTypeDescription
rotation
scale

get_layer_labeling Get Layer Labeling

Get the labeling configuration of a vector layer: enabled state, field, font size, color.

ParameterTypeDescription
layer_id *string

set_layer_labeling Set Layer Labeling

Configure labeling for a vector layer. Set enabled=false to disable labels. Set field_name to the attribute field to label with. Optional: font_size (float), color (hex like '#000000').

ParameterTypeDescription
layer_id *string
color
enabledboolean
field_name
font_size

get_layer_crs Get Layer CRS

Get the coordinate reference system (CRS) of a layer: EPSG code, description, whether geographic, and PROJ4 string.

ParameterTypeDescription
layer_id *string

set_layer_crs Set Layer CRS

Set the CRS of a layer (e.g. 'EPSG:4326'). This does NOT reproject data - it only changes how the layer's coordinates are interpreted.

ParameterTypeDescription
crs *string
layer_id *string

set_project_crs Set Project CRS

Set the project coordinate reference system (e.g. 'EPSG:4326', 'EPSG:3857'). This changes how layers are projected on the map canvas.

ParameterTypeDescription
crs *string

get_bookmarks Get Bookmarks

Get spatial bookmarks from the project. Each bookmark has a name, group, extent (xmin/ymin/xmax/ymax), and CRS.

add_bookmark Add Bookmark

Add a spatial bookmark to the project for quick navigation. Provide a name and extent (xmin/ymin/xmax/ymax), in crs when given, else the project CRS.

ParameterTypeDescription
name *string
xmax *number
xmin *number
ymax *number
ymin *number
crs
groupstring

remove_bookmark Remove Bookmark

Remove a spatial bookmark by its ID.

ParameterTypeDescription
bookmark_id *string

get_map_themes Get Map Themes

Get map themes (visibility presets). Each theme stores which layers are visible.

add_map_theme Add Map Theme

Create a map theme from the current layer visibility state. If a theme with this name exists, it will be updated.

ParameterTypeDescription
name *string

remove_map_theme Remove Map Theme

Remove a map theme by name.

ParameterTypeDescription
name *string

apply_map_theme Apply Map Theme

Apply a map theme - restores the layer visibility state saved in the theme.

ParameterTypeDescription
name *string

batch_commands Batch Commands

Execute multiple commands in a single round-trip. Each command is {"type": "<command_name>", "params": {...}}. Destructive commands (batch, delete_features, execute_code, execute_connection_sql, import_layer_to_connection, reload_plugin, remove_layer, rollback_edits, set_setting) are not allowed in batch, call them individually.

ParameterTypeDescription
commands *array

list_layouts List Layouts

List all print layouts in the current project with names and page counts.

export_layout Export Layout

Export a print layout to file. format: 'pdf', 'png', 'jpg', 'svg'. dpi: resolution (default 300).

ParameterTypeDescription
layout_name *string
path *string
dpiinteger
formatstring

create_layout Create Layout

Create a new print layout. page_size: e.g. 'A4', 'A3', 'Letter'. orientation: 'landscape' or 'portrait'.

ParameterTypeDescription
name *string
orientationstring
page_sizestring

get_layout_info Get Layout Info

List items in a print layout (type, id, uuid, position, size) and page count.

ParameterTypeDescription
layout_name *string

remove_layout Remove Layout

Remove a print layout from the project.

ParameterTypeDescription
layout_name *string

add_layout_map Add Layout Map

Add a map item to a print layout at specified position and size (in millimeters). Optional extent=[xmin, ymin, xmax, ymax] and scale override the canvas view.

ParameterTypeDescription
height *number
layout_name *string
width *number
x *number
y *number
extent
scale

add_layout_label Add Layout Label

Add a text label to a print layout (mm). text may contain [% expression %] for dynamic content. color is hex (e.g. '#000000').

ParameterTypeDescription
layout_name *string
text *string
colorstring
font_sizeinteger
heightnumber
widthnumber
xnumber
ynumber

add_layout_legend Add Layout Legend

Add a legend to a print layout, linked to a map item (defaults to the first map item). Position/size in mm. Optional layer_ids restricts the legend to specific layers.

ParameterTypeDescription
layout_name *string
heightnumber
layer_ids
map_item_id
titlestring
widthnumber
xnumber
ynumber

add_layout_scalebar Add Layout Scale Bar

Add a scale bar to a print layout, linked to a map item. style e.g. 'Single Box', 'Double Box', 'Line Ticks Up', 'Numeric'.

ParameterTypeDescription
layout_name *string
heightnumber
map_item_id
stylestring
widthnumber
xnumber
ynumber

add_layout_picture Add Layout Picture

Add a picture or SVG (logo, north arrow) to a print layout. path is an image or SVG file path. Position/size in mm.

ParameterTypeDescription
layout_name *string
path *string
heightnumber
widthnumber
xnumber
ynumber

add_layout_table Add Layout Table

Add an attribute table for a vector layer to a print layout. max_rows caps the number of features shown. Position/size in mm.

ParameterTypeDescription
layer_id *string
layout_name *string
heightnumber
max_rowsinteger
widthnumber
xnumber
ynumber

add_layout_grid Add Layout Grid

Add a coordinate grid to a map item in a print layout. interval_x/interval_y set grid spacing in map or grid CRS units.

ParameterTypeDescription
layout_name *string
crs
interval_xnumber
interval_ynumber
map_item_id
namestring
show_annotationsboolean

update_layout_item Update Layout Item

Move, resize, update text, or toggle visibility of an item in a print layout.

ParameterTypeDescription
item_id *string
layout_name *string
height
text
visible
width
x
y

remove_layout_item Remove Layout Item

Remove an item from a print layout by UUID or ID.

ParameterTypeDescription
item_id *string
layout_name *string

configure_atlas Configure Atlas

Configure a print layout's atlas: coverage_layer (vector layer id) drives one page per feature. Optional page_name_expression, filter_expression, sort_expression.

ParameterTypeDescription
coverage_layer *string
layout_name *string
enabledboolean
filter_expression
page_name_expression
sort_expression

export_atlas Export Atlas

Export a configured atlas. format 'pdf' writes a single multi-page file at output_path; image formats ('png','jpg','tif') write one file per feature into the output_path directory. Call configure_atlas first.

ParameterTypeDescription
layout_name *string
output_path *string
dpiinteger
formatstring

get_message_log Get Message Log

Get QGIS message log entries. Filter by level ('info', 'warning', 'critical', 'success', 'none') and/or tag (e.g. 'QGIS MCP'). Returns newest first.

ParameterTypeDescription
level
limitinteger
tag

list_plugins List Plugins

List installed QGIS plugins with name, enabled status, and version. Set enabled_only=true to list only active plugins.

ParameterTypeDescription
enabled_onlyboolean

get_plugin_info Get Plugin Info

Get detailed info for a specific plugin: name, enabled, version, description, author, path.

ParameterTypeDescription
plugin_name *string

reload_plugin Reload Plugin

Reload a QGIS plugin by name. Cannot reload the MCP plugin itself. Useful during plugin development.

ParameterTypeDescription
plugin_name *string

get_layer_tree Get Layer Tree

Get the full layer tree structure with groups and layers. Returns recursive tree with type, name, visibility, and children.

create_layer_group Create Layer Group

Create a new layer group in the layer tree. Optionally specify a parent group name.

ParameterTypeDescription
name *string
parent

move_layer_to_group Move Layer to Group

Move a layer into a layer group by group name.

ParameterTypeDescription
group_name *string
layer_id *string

set_layer_order Set Layer Order

Reorder layer tree nodes; tree order is draw order. layer_ids is the ordered list of layer ids from top (drawn last) to bottom; unlisted layers keep their slots. Clears any custom draw order (it freezes a snapshot list - layers added later would silently draw behind everything).

ParameterTypeDescription
layer_ids *array

set_layer_property Set Layer Property

Set a layer property. Supported properties: opacity (0.0-1.0), name (string), min_scale, max_scale (float), scale_visibility (bool).

ParameterTypeDescription
layer_id *string
property *string
value *string

get_layer_extent Get Layer Extent

Get the spatial extent (bounding box) and CRS of a layer.

ParameterTypeDescription
layer_id *string

get_project_variables Get Project Variables

Get all project-level variables (key-value pairs set in Project Properties).

set_project_variable Set Project Variable

Set a project-level variable. Variables are accessible in expressions as @key.

ParameterTypeDescription
key *string
value *string

validate_expression Validate Expression

Validate a QGIS expression. Returns whether it's valid, any parse errors, and referenced column names. Optionally test against a layer's fields.

ParameterTypeDescription
expression *string
layer_id

evaluate_expression Evaluate Expression

Evaluate a standalone QGIS expression to a scalar value (e.g. aggregate('layer','sum','field'), @project_var, now()). Optional layer_id adds layer scope. Distinct from validate_expression (validate only) and field_calculator (per-feature).

ParameterTypeDescription
expression *string
layer_id

get_setting Get Setting

Read a QGIS setting by key path (e.g. 'qgis/sketching/sketching_enabled').

ParameterTypeDescription
key *string

set_setting Set Setting

Write a QGIS setting. Use with care - incorrect settings can affect QGIS behavior.

ParameterTypeDescription
key *string
value *string

transform_coordinates Transform Coordinates

Transform coordinates between CRS. Accepts a point {x, y}, a point list [{x, y}, ...], or a bbox {xmin, ymin, xmax, ymax}. Returns the same format. x is always longitude/easting and y latitude/northing, including for EPSG:4326. A bbox that crosses the antimeridian comes back with xmin > xmax and crosses_antimeridian: true.

ParameterTypeDescription
source_crs *string
target_crs *string
bbox
point
points

list_connections List Connections

List the data source connections saved in QGIS (PostgreSQL, GeoPackage, SpatiaLite, MS SQL, Oracle, ...) - the Browser panel entries. Optionally filter by provider (e.g. 'postgres', 'ogr', 'spatialite'). Passwords are redacted from the URIs.

ParameterTypeDescription
provider

create_postgresql_connection Create PostgreSQL Connection

Validate and save a new PostgreSQL Browser-panel connection. Passwords are never accepted: credentials come from a QGIS Authentication Manager configuration, from the libpq service file (pg_service.conf), or both. connection_mode selects which parameters are required; when the user's intent is unclear, ask which mode applies before calling. endpoint_using_auth_manager: host, port, database, auth_config_id (port must be the actual database port supplied by the caller or user, this tool never assumes 5432). service_using_auth_manager: service (the name defined in pg_service.conf) and auth_config…

ParameterTypeDescription
connection_mode *string
name *string
auth_config_id
database
host
port
service
ssl_modestring

list_connection_tables List Connection Tables

List tables reachable through a saved connection. On providers with schemas (PostgreSQL), omit schema to get the schema list first, then pass one. Returns each table's geometry column, CRS, primary key and kind.

ParameterTypeDescription
connection *string
provider *string
schema

add_layer_from_connection Add Layer from Connection

Load a table from a saved connection as a project layer. Pass table (+ schema), or sql to build a query layer executed by the database. For a SQL layer, geometry_column and primary_key may be needed for QGIS to map/identify the result.

ParameterTypeDescription
connection *string
provider *string
geometry_column
name
primary_key
schema
sql
table

import_layer_to_connection Import Layer to Connection

Write a loaded vector layer into a saved connection as a new table (PostgreSQL, GeoPackage, ...). Fails if the table exists unless overwrite=true.

ParameterTypeDescription
connection *string
layer_id *string
provider *string
table *string
overwriteboolean
schema

execute_connection_sql Execute Connection SQL

Run SQL directly on the database behind a saved connection (server-side, not a virtual layer - use execute_sql for that). Can modify the database: DDL/DML run as issued. limit caps returned rows (-1 for all).

ParameterTypeDescription
connection *string
provider *string
sql *string
limitinteger