Skip to main content
Glama
mahdin75

GeoServer MCP Server

delete_resource

Remove specific resources like workspaces, layers, or styles from GeoServer by specifying the resource type, workspace, and name.

Instructions

Delete a resource from GeoServer.

Args:
    resource_type: Type of resource to delete (workspace, layer, style, etc.)
    workspace: The workspace containing the resource
    name: The name of the resource

Returns:
    Dict with status and result information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
resource_typeYes
workspaceYes

Implementation Reference

  • Implementation of the delete_resource tool handler, including registration via @mcp.tool() decorator. Handles deletion of various GeoServer resources (workspace, layer, datastore, style, coverage) using the GeoServer REST API.
    @mcp.tool()
    def delete_resource(resource_type: str, workspace: str, name: str) -> Dict[str, Any]:
        """Delete a resource from GeoServer.
        
        Args:
            resource_type: Type of resource to delete (workspace, layer, style, etc.)
            workspace: The workspace containing the resource
            name: The name of the resource
        
        Returns:
            Dict with status and result information
        """
        geo = get_geoserver()
        if geo is None:
            raise ValueError("Not connected to GeoServer")
        
        if not resource_type or not name:
            raise ValueError("Resource type and name are required")
        
        # Validate resource type
        valid_types = ["workspace", "layer", "datastore", "style", "coverage"]
        if resource_type.lower() not in valid_types:
            raise ValueError(f"Invalid resource type. Must be one of: {', '.join(valid_types)}")
        
        try:
            # Use the appropriate GeoServer REST API method based on resource_type
            if resource_type.lower() == "workspace":
                geo.delete_workspace(name)
            elif resource_type.lower() == "layer":
                geo.delete_layer(name, workspace)
            elif resource_type.lower() == "datastore":
                geo.delete_datastore(name, workspace)
            elif resource_type.lower() == "style":
                geo.delete_style(name, workspace)
            elif resource_type.lower() == "coverage":
                geo.delete_coverage(name, workspace)
            
            return {
                "status": "success",
                "type": resource_type,
                "name": name,
                "workspace": workspace if workspace else "global",
                "message": f"{resource_type.capitalize()} '{name}' deleted successfully"
            }
        except Exception as e:
            logger.error(f"Error deleting resource: {str(e)}")
            raise ValueError(f"Failed to delete resource: {str(e)}")
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses the destructive nature ('Delete'), but lacks critical behavioral details: it doesn't specify if deletion is permanent, what permissions are required, potential side effects (e.g., cascading deletions), rate limits, or error handling. For a destructive tool with zero annotation coverage, this is a significant gap.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by a structured breakdown of args and returns. Every sentence earns its place by adding necessary information, though the 'Returns' section could be more detailed given no output schema.

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 (destructive operation with 3 parameters), lack of annotations, and no output schema, the description is incomplete. It covers basic purpose and parameters but misses critical context: behavioral traits (e.g., irreversibility), usage guidelines, and detailed return values. For a deletion tool, this leaves the agent under-informed.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It adds value by explaining each parameter's purpose (e.g., 'resource_type: Type of resource to delete (workspace, layer, style, etc.)'), which clarifies beyond the schema's bare titles. However, it doesn't provide examples, constraints (e.g., valid resource_type values), or format details, leaving some ambiguity.

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 ('Delete') and target ('a resource from GeoServer'), providing a specific verb+resource combination. It distinguishes from siblings like create_layer, create_style, etc., which are creation operations rather than deletions. However, it doesn't explicitly differentiate from potential other deletion tools (none listed in siblings).

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. The description doesn't mention prerequisites (e.g., resource must exist), exclusions (e.g., cannot delete if in use), or comparisons to other tools like list_layers for verification. It only states what it does, not when to apply it.

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

Related 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/mahdin75/geoserver-mcp'

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