Skip to main content
Glama

save_project

Save QGIS projects to specified or current paths, preserving all layers, settings, and configurations 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'. Proxies the command to the underlying QGIS socket server via send_command.
    @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 QGIS handler implementation for saving the current project using QgsProject.write().
    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 (line 146) in the QGIS MCP 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,
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a write operation ('save'), but lacks details on permissions, whether it overwrites existing files, error handling, or response format. This is inadequate for a mutation tool with zero annotation coverage.

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?

The description is a single, efficient sentence that front-loads the core action and parameter behavior. There is no wasted wording, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation operation with no annotations or output schema), the description is incomplete. It lacks details on behavioral traits like overwrite behavior, error conditions, or what happens if no project is open, leaving significant gaps for an AI agent.

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?

The description adds meaningful context for the single parameter 'path', explaining it's optional and defaults to the current project path. With 0% schema description coverage and only one parameter, this compensates well, providing clear semantics beyond the basic schema.

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?

The description clearly states the action ('save') and resource ('current project'), specifying it saves to a given path or defaults to the current project path. It distinguishes from sibling tools like 'create_new_project' (creation) and 'load_project' (loading), but doesn't explicitly contrast with them, keeping it at a 4.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'create_new_project' for new projects or 'load_project' for loading existing ones. It mentions the optional path parameter but offers no context on prerequisites, such as needing an open project, which is a significant gap.

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

Install Server

Other Tools

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