Skip to main content
Glama

save_project

Save QGIS projects to specified or current locations to preserve map layouts, layer configurations, and analysis workflows for future use.

Instructions

Save the current project to the given path, or to the current project path if not specified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo

Implementation Reference

  • MCP tool handler for 'save_project' that proxies the command to the QGIS socket server via get_qgis_connection().
    @mcp.tool() def save_project(ctx: Context, path: str = None) -> str: """Save the current project to the given path, or to the current project path if not specified.""" qgis = get_qgis_connection() params = {} if path: params["path"] = path result = qgis.send_command("save_project", params) return json.dumps(result, indent=2)
  • Core implementation of save_project command in QGIS plugin server, using QgsProject.instance().write() to save the project.
    def save_project(self, path=None, **kwargs): """Save the current project""" project = QgsProject.instance() if not path and not project.fileName(): raise Exception("No project path specified and no current project path") save_path = path if path else project.fileName() if project.write(save_path): return {"saved": save_path} else: raise Exception(f"Failed to save project to {save_path}")
  • Registration of the save_project handler in the QGIS socket server's command handlers dictionary.
    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, }
  • Client-side wrapper method for save_project command.
    def save_project(self, path=None): """Save the current project""" params = {} if path: params["path"] = path return self.send_command("save_project", params)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/syauqi-uqi/qgis_mcp_modify1'

If you have feedback or need assistance with the MCP directory API, please join our Discord server