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)}")
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it states this is a creation operation, it doesn't mention permissions required, whether the style becomes immediately available, what happens on duplicate names, or any rate limits. The return format is mentioned but lacks detail about what 'status and style information' includes.

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 efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence adds value, though the Returns section could be more specific about what information is included. The structure helps with quick scanning.

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

Completeness3/5

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

For a creation tool with 3 parameters, no annotations, and no output schema, the description provides adequate basics but lacks important context. It covers the purpose and parameters reasonably well but misses behavioral details like error conditions, authentication requirements, and specific return format that would be needed for reliable tool invocation.

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

Parameters4/5

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

With 0% schema description coverage, the description compensates well by explaining all three parameters: 'name' for the style name, 'sld' for XML content, and 'workspace' as optional. It clarifies that workspace is optional and provides context about what each parameter represents, though it doesn't specify format constraints for the SLD XML.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Create a new SLD style'), resource ('in GeoServer'), and technology context ('SLD style'). It distinguishes from siblings like create_layer or create_workspace by specifying it creates a style rather than other GeoServer resources.

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?

The description provides no guidance on when to use this tool versus alternatives. While it's clear this creates styles, there's no mention of when to create a style versus using existing ones, or how this relates to sibling tools like create_layer or generate_map that might involve styling.

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