Skip to main content
Glama
mahdin75

GeoServer MCP Server

create_style

Generate SLD styles for GeoServer by specifying a style name and SLD XML content. Optional workspace inclusion allows for organized style management within GeoServer.

Instructions

Create a new SLD style in GeoServer.

Args: name: Name for the style sld: SLD XML content workspace: Optional workspace for the style Returns: Dict with status and style information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
sldYes
workspaceNo

Implementation Reference

  • MCP tool handler implementation for 'create_style'. Decorated with @mcp.tool(), connects to GeoServer, validates inputs, calls the underlying Geoserver client to create the style, and returns success status.
    @mcp.tool() def create_style(name: str, sld: str, workspace: Optional[str] = None) -> Dict[str, Any]: """Create a new SLD style in GeoServer. Args: name: Name for the style sld: SLD XML content workspace: Optional workspace for the style Returns: Dict with status and style information """ geo = get_geoserver() if geo is None: raise ValueError("Not connected to GeoServer") if not name: raise ValueError("Style name is required") if not sld: raise ValueError("SLD content is required") try: # Use the actual GeoServer REST API to create a style if workspace: geo.create_style(name, sld, workspace) message = f"Style '{name}' created in workspace '{workspace}'" else: geo.create_style(name, sld) message = f"Global style '{name}' created" return { "status": "success", "name": name, "workspace": workspace if workspace else "global", "message": message } except Exception as e: logger.error(f"Error creating style: {str(e)}") raise ValueError(f"Failed to create style: {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