execute_processing
Run QGIS processing algorithms with specified parameters to perform geospatial analysis and data manipulation tasks.
Instructions
Execute a processing algorithm with the given parameters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| algorithm | Yes | ||
| parameters | Yes |
Implementation Reference
- Core handler that executes the QGIS processing algorithm using the processing.run() function. This is the actual implementation performing the tool logic.def execute_processing(self, algorithm, parameters, **kwargs): """Execute a processing algorithm""" try: import processing result = processing.run(algorithm, parameters) return { "algorithm": algorithm, "result": {k: str(v) for k, v in result.items()} # Convert values to strings for JSON } except Exception as e: raise Exception(f"Processing error: {str(e)}")
- src/qgis_mcp/qgis_mcp_server.py:229-234 (handler)MCP tool handler for 'execute_processing'. Proxies the request to the QGIS plugin server via socket connection.@mcp.tool() def execute_processing(ctx: Context, algorithm: str, parameters: dict) -> str: """Execute a processing algorithm with the given parameters.""" qgis = get_qgis_connection() result = qgis.send_command("execute_processing", {"algorithm": algorithm, "parameters": parameters}) return json.dumps(result, indent=2)
- qgis_mcp_plugin/qgis_mcp_plugin.py:133-149 (registration)Registration of all command handlers in the QGIS plugin server, including 'execute_processing' mapped to its handler method.handlers = { "ping": self.ping, "get_qgis_info": self.get_qgis_info, "load_project": self.load_project, "get_project_info": self.get_project_info, "execute_code": self.execute_code, "add_vector_layer": self.add_vector_layer, "add_raster_layer": self.add_raster_layer, "get_layers": self.get_layers, "remove_layer": self.remove_layer, "zoom_to_layer": self.zoom_to_layer, "get_layer_features": self.get_layer_features, "execute_processing": self.execute_processing, "save_project": self.save_project, "render_map": self.render_map, "create_new_project": self.create_new_project, }
- qgis_mcp_plugin/qgis_mcp_plugin.py:145-145 (registration)Specific registration entry for 'execute_processing' in the plugin's handlers dictionary."execute_processing": self.execute_processing,
- Client-side wrapper method for sending 'execute_processing' command to the QGIS server.def execute_processing(self, algorithm, parameters): """Execute a processing algorithm""" return self.send_command("execute_processing", { "algorithm": algorithm, "parameters": parameters })