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)}")

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