Skip to main content
Glama

create_new_project

Create and save a new QGIS project by specifying a file path, enabling users to start working with geographic data and analysis.

Instructions

Create a new project a save it

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP tool handler for create_new_project that proxies the command to the QGIS plugin server
    @mcp.tool()
    def create_new_project(ctx: Context, path: str) -> str:
        """Create a new project a save it"""
        qgis = get_qgis_connection()
        result = qgis.send_command("create_new_project", {"path": path})
        return json.dumps(result, indent=2)
  • Registration of the create_new_project command handler in the QGIS plugin's execute_command 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,
    }
  • Core implementation of create_new_project in QGIS plugin: clears existing project, sets new path, refreshes canvas, and saves the project file
    def create_new_project(self, path, **kwargs):
        """
        Creates a new QGIS project and saves it at the specified path.
        If a project is already loaded, it clears it before creating the new one.
        
        :param project_path: Full path where the project will be saved
                            (e.g., 'C:/path/to/project.qgz')
        """
        project = QgsProject.instance()
        
        if project.fileName():
            project.clear()
        
        project.setFileName(path)
        self.iface.mapCanvas().refresh()
        
        # Save the project
        if project.write():
            return {
                "created": f"Project created and saved successfully at: {path}",
                "layer_count": len(project.mapLayers())
            }
        else:

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.4/5.0
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only states the action but does not explain side effects (e.g., whether it overwrites existing files), required permissions, or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very short (one sentence), which is concise, but it contains a grammatical error and omits essential information. It is not well-structured for quick comprehension.

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

Completeness1/5

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

Given the absence of annotations, output schema, and parameter details, the description is critically incomplete. It does not cover return values, error handling, or the exact behavior of the creation process.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage and the tool description does not mention the 'path' parameter or its format (file vs directory). The description adds no semantic value beyond the 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 (create a new project) and distinguishes it from siblings like 'load_project' and 'save_project'. The typo 'a save it' slightly reduces clarity but the purpose is still evident.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it does not differentiate between creating a new project and saving an existing one, nor does it mention prerequisites like path validation.

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