Skip to main content
Glama
mahdin75

GeoServer MCP Server

list_layers

Retrieve a list of layers in GeoServer, optionally filtered by workspace. Returns detailed layer information for geospatial data management and analysis.

Instructions

List layers in GeoServer, optionally filtered by workspace.

Args:
    workspace: Optional workspace to filter layers

Returns:
    List of layer information dictionaries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNo

Implementation Reference

  • The handler function for the 'list_layers' MCP tool. It connects to GeoServer via the Geoserver client, lists layers (optionally filtered by workspace), and returns a list of layer dictionaries. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool()
    def list_layers(workspace: Optional[str] = None) -> List[Dict[str, Any]]:
        """List layers in GeoServer, optionally filtered by workspace.
        
        Args:
            workspace: Optional workspace to filter layers
        
        Returns:
            List of layer information dictionaries
        """
        geo = get_geoserver()
        if geo is None:
            raise ValueError("Not connected to GeoServer")
        
        try:
            # Use the actual GeoServer REST API to list layers
            if workspace:
                layers = geo.get_layers(workspace)
            else:
                layers = geo.get_layers()
            
            return layers
        except Exception as e:
            logger.error(f"Error listing layers: {str(e)}")
            raise ValueError(f"Failed to list layers: {str(e)}")
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