qfield-mcp
v0.3.0MCP server driving a real QField app, for agents exploring and testing plugins
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
start_device
Start a QField with its own profile and display. :param version: QField release, `latest` for the newest. Without it the server's `$QFIELD_APP_BINARY` runs if set, else 4.2.9 :param plugin_dir: Plugin to load with its root reachable as `plugin` :param project: Project file to open after start :param grant_project_plugin: Answer the project plugin permission prompt :param settings: QSettings written before start, `{"myplugin/key": 1}`
| Parameter | Type | Description |
|---|---|---|
grant_project_plugin | boolean | |
name | string | |
plugin_dir | ||
project | ||
settings | ||
version |
stop_device
Stop a QField and remove it from the running devices.
| Parameter | Type | Description |
|---|---|---|
name | string |
list_devices
Names of the running devices.
reload_plugin
Load the hosted plugin again from its directory, edits included.
| Parameter | Type | Description |
|---|---|---|
device | string |
eval_js
Run a JS function body in QField and return its JSON result. The body sees `iface`, `find` (iface.findItemByObjectName), `findItem` (search by objectName in the scene, popups and the hosted plugin), `search`, `walk`, `walkAll`, `scene`, `state` (kept between calls), `plugin`, `qgisProject`, `layerObserver`, `pluginManager`, `settings`, `platformUtilities`, `messageLogModel`, `featureHistory`, `flatLayerTree`, `trackingModel`, `LayerUtils`, `GeometryUtils`, `FeatureUtils`, `StringUtils` and `Theme`. Use `return` to get a value back. QML exposes less of the QGIS API than PyQGIS. `qgisProject.m…
| Parameter | Type | Description |
|---|---|---|
code * | string | |
device | string |
item_tree
List items on screen as an indented tree. Each line has type, #objectName, text, icon, [clickable], @x,y window position and size. Positions are tap targets. :param root: objectName of the item to start from, the whole window by default :param named_only: Only list items with an objectName or text :param clickable_only: Only list items that react to taps
| Parameter | Type | Description |
|---|---|---|
clickable_only | boolean | |
device | string | |
max_depth | integer | |
max_items | integer | |
named_only | boolean | |
root | ||
visible_only | boolean |
find_items
Find visible items whose objectName, text or icon contains `query`. Case is ignored, and items are listed one per line as in item_tree.
| Parameter | Type | Description |
|---|---|---|
query * | string | |
clickable_only | boolean | |
device | string | |
max_items | integer |
wait_for
Wait until a JS function body returns something truthy, or text shows. With `text`, waits until an item with the text is visible. :param gone: Wait for the text to disappear instead
| Parameter | Type | Description |
|---|---|---|
device | string | |
gone | boolean | |
js | ||
text | ||
timeout | number |
screenshot
Take a PNG of the window, or of one item. Refused while a camera is open. :param scale: Size factor, 0.5 gives a quarter of the pixels
| Parameter | Type | Description |
|---|---|---|
device | string | |
object_name | ||
scale | number |
messages
Newest messages of QField's message log, what iface.logMessage writes.
| Parameter | Type | Description |
|---|---|---|
device | string | |
last | integer | |
tag |
log
QField's stdout and stderr since the previous call.
| Parameter | Type | Description |
|---|---|---|
device | string |
tap
Tap an item by objectName or visible text, or a window position.
| Parameter | Type | Description |
|---|---|---|
device | string | |
long_press | boolean | |
object_name | ||
text | ||
x | ||
y |
tap_map
Tap the map where a project CRS coordinate is drawn.
| Parameter | Type | Description |
|---|---|---|
x * | number | |
y * | number | |
device | string | |
long_press | boolean |
frame_map
Show the map around a project CRS coordinate.
| Parameter | Type | Description |
|---|---|---|
x * | number | |
y * | number | |
device | string | |
half_size | number |
type_text
Type into whatever has keyboard focus, tap a field first.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
device | string |
key
Press one key by keysym name: Return, Escape, BackSpace, Tab.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
device | string |
open_project
Open a project file.
| Parameter | Type | Description |
|---|---|---|
path * | string | |
device | string | |
grant_project_plugin | boolean |
set_position
Feed a GNSS fix at a project CRS coordinate through a fake receiver. The accuracies are in metres. fix_quality is how the receiver computed the fix: rtk (centimetres), float_rtk (decimetres), dgps (below a metre), gps (metres) or no_fix, which QField receives but shows no position for.
| Parameter | Type | Description |
|---|---|---|
x * | number | |
y * | number | |
device | string | |
fix_quality | string | |
horizontal_accuracy | number | |
vertical_accuracy | number |
features
Attribute values of a layer's features, filtered by a QGIS expression.
| Parameter | Type | Description |
|---|---|---|
fields * | array | |
layer * | string | |
device | string | |
expression | string |
open_feature_form
Open the form of the first feature matching a QGIS expression.
| Parameter | Type | Description |
|---|---|---|
expression * | string | |
layer * | string | |
device | string | |
edit | boolean |
set_field
Change a field of the open feature form through its editor widget. Works on the form of an existing feature and on the form of a feature that digitizing just added, whichever is open. :param label: The field's alias, its name when it has none
| Parameter | Type | Description |
|---|---|---|
label * | string | |
value * | ||
device | string |
save_form
Save the open feature form, a digitized feature's form too.
| Parameter | Type | Description |
|---|---|---|
device | string |
close_feature_form
Close the feature form and list without saving.
| Parameter | Type | Description |
|---|---|---|
device | string |
delete_feature
Delete the first feature matching a QGIS expression, as a user would. Opens its form, taps the form menu, `Delete Feature` and `OK`.
| Parameter | Type | Description |
|---|---|---|
expression * | string | |
layer * | string | |
device | string |
set_active_layer
Make a layer the one that digitizing adds features to.
| Parameter | Type | Description |
|---|---|---|
layer * | string | |
device | string |
digitize_point
Add a point by tapping the map in digitize mode, fill one field and save. The point must be on screen, use frame_map first. To fill several fields, switch to digitize mode with eval_js, use tap_map, set_field and save_form. :param x: Project CRS coordinate :param label: The field to fill, its alias, its name when it has none
| Parameter | Type | Description |
|---|---|---|
label * | string | |
layer * | string | |
value * | ||
x * | number | |
y * | number | |
device | string |
add_feature
Add a feature and commit it, as plugin JS does, without any form. :param wkt: Geometry in the layer's CRS, `Point (385000 6672000)` :param attributes: Values by field name
| Parameter | Type | Description |
|---|---|---|
attributes * | object | |
layer * | string | |
device | string | |
wkt |
change_geometry
Replace the geometry of the first feature matching an expression and save. :param wkt: New geometry in the layer's CRS
| Parameter | Type | Description |
|---|---|---|
expression * | string | |
layer * | string | |
wkt * | string | |
device | string |
cloud_up
Start a local QFieldCloud of a release and return its URL. The first start of a release builds images, which takes many minutes. To use a stack that already runs, see cloud_attach. :param ref: `hosted` (what app.qfield.cloud runs), `latest` or a tag. Without it the server's `$QFIELDCLOUD_SOURCE_DIR` checkout runs if set, else hosted :param port_offset: Move every port and the compose project up by this much, so stacks of parallel checkouts do not collide. Without it `$QFIELDCLOUD_PORT_OFFSET` or 0 :param name: Compose project name instead of the one derived from the release
| Parameter | Type | Description |
|---|---|---|
name | ||
port_offset | ||
ref |
cloud_attach
Use a local QFieldCloud that already runs, without building or starting it. Give what cloud_up was given, or the compose project `name` and `https_port` of a stack some other run started, such as an e2e run's. Use it after the server restarted too, the stack keeps running meanwhile. The admin tools and cloud_login then use this stack.
| Parameter | Type | Description |
|---|---|---|
https_port | ||
name | ||
port_offset | ||
ref |
cloud_status
Show the local QFieldCloud the cloud tools use, its URL and if it answers.
cloud_user
Create a user on the local QFieldCloud, or leave an existing one alone. Give each device a user of its own, a login ends the user's other sessions.
| Parameter | Type | Description |
|---|---|---|
password * | string | |
username * | string | |
superuser | boolean |
cloud_create_project
Create a project on the local QFieldCloud and return its id. With `directory` the project's files go up and the project is packaged, which is what a device needs to download it. :param directory: A QField project directory to upload :param collaborators: Usernames added as editors, they must exist :param username: Owner of the project, the admin by default
| Parameter | Type | Description |
|---|---|---|
name * | string | |
collaborators | ||
directory | ||
password | ||
username |
cloud_add_collaborator
Give a user a role on a project of the local QFieldCloud. :param role: `reader`, `reporter`, `editor`, `manager` or `admin` :param username: A user who may manage the project, the admin by default
| Parameter | Type | Description |
|---|---|---|
collaborator * | string | |
project_id * | string | |
password | ||
role | string | |
username |
cloud_upload
Upload a project directory to the local QFieldCloud, and package it. :param package: Run the package job devices download from
| Parameter | Type | Description |
|---|---|---|
directory * | string | |
project_id * | string | |
package | boolean | |
password | ||
username |
cloud_package
Run the package job of a project and wait for it to finish.
| Parameter | Type | Description |
|---|---|---|
project_id * | string | |
password | ||
username |
cloud_deltas
Deltas a project received, with their status, such as `STATUS_APPLIED`.
| Parameter | Type | Description |
|---|---|---|
project_id * | string | |
password | ||
username |
cloud_login
Log a device in to a QFieldCloud. :param url: Without it the stack of cloud_up or cloud_attach
| Parameter | Type | Description |
|---|---|---|
device | string | |
password | ||
url | ||
username |
cloud_download
Download a cloud project the device's user can see, and open it. :param grant_project_plugin: Answer the project plugin permission prompt while opening
| Parameter | Type | Description |
|---|---|---|
project_id * | string | |
device | string | |
grant_project_plugin | boolean | |
open_it | boolean |
cloud_synchronize
Push local edits and download the latest state, as Synchronize does.
| Parameter | Type | Description |
|---|---|---|
project_id * | string | |
device | string |