Skip to main content
Glama
echelon-ai-labs

ServiceNow MCP Server

create_changeset

Generate a changeset in ServiceNow by specifying the application, name, and optional details like developer and description to organize and track updates.

Instructions

Create a new changeset in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • Main handler function for the create_changeset tool. Validates input parameters, constructs the API request to ServiceNow's sys_update_set table, and returns the created changeset or error.
    def create_changeset(
        auth_manager: AuthManager,
        server_config: ServerConfig,
        params: Union[Dict[str, Any], CreateChangesetParams],
    ) -> Dict[str, Any]:
        """
        Create a new changeset in ServiceNow.
    
        Args:
            auth_manager: The authentication manager.
            server_config: The server configuration.
            params: The parameters for creating a changeset. Can be a dictionary or a CreateChangesetParams object.
    
        Returns:
            The created changeset.
        """
        # Unwrap and validate parameters
        result = _unwrap_and_validate_params(
            params, 
            CreateChangesetParams, 
            required_fields=["name", "application"]
        )
        
        if not result["success"]:
            return result
        
        validated_params = result["params"]
        
        # Prepare the request data
        data = {
            "name": validated_params.name,
            "application": validated_params.application,
        }
        
        # Add optional fields if provided
        if validated_params.description:
            data["description"] = validated_params.description
        if validated_params.developer:
            data["developer"] = validated_params.developer
        
        # Get the instance URL
        instance_url = _get_instance_url(auth_manager, server_config)
        if not instance_url:
            return {
                "success": False,
                "message": "Cannot find instance_url in either server_config or auth_manager",
            }
        
        # Get the headers
        headers = _get_headers(auth_manager, server_config)
        if not headers:
            return {
                "success": False,
                "message": "Cannot find get_headers method in either auth_manager or server_config",
            }
        
        # Add Content-Type header
        headers["Content-Type"] = "application/json"
        
        # Make the API request
        url = f"{instance_url}/api/now/table/sys_update_set"
        
        try:
            response = requests.post(url, json=data, headers=headers)
            response.raise_for_status()
            
            result = response.json()
            
            return {
                "success": True,
                "message": "Changeset created successfully",
                "changeset": result["result"],
            }
        except requests.exceptions.RequestException as e:
            logger.error(f"Error creating changeset: {e}")
            return {
                "success": False,
                "message": f"Error creating changeset: {str(e)}",
            }
  • Pydantic model defining the input schema for the create_changeset tool, including required fields name and application, and optional description and developer.
    class CreateChangesetParams(BaseModel):
        """Parameters for creating a changeset."""
    
        name: str = Field(..., description="Name of the changeset")
        description: Optional[str] = Field(None, description="Description of the changeset")
        application: str = Field(..., description="Application the changeset belongs to")
        developer: Optional[str] = Field(None, description="Developer responsible for the changeset")
  • Registers the create_changeset tool in the MCP tool definitions dictionary, specifying the handler function (create_changeset_tool), input schema (CreateChangesetParams), description, and serialization method.
    "create_changeset": (
        create_changeset_tool,
        CreateChangesetParams,
        str,  # Expects JSON string
        "Create a new changeset in ServiceNow",
        "json_dict",  # Tool returns Pydantic model
    ),
  • Imports the create_changeset function into the tools package namespace, making it available for export.
    from servicenow_mcp.tools.changeset_tools import (
        add_file_to_changeset,
        commit_changeset,
        create_changeset,
        get_changeset_details,
        list_changesets,
        publish_changeset,
        update_changeset,
    )
  • Helper function used by create_changeset to unwrap and validate input parameters against the Pydantic model, checking for required fields.
    def _unwrap_and_validate_params(
        params: Union[Dict[str, Any], BaseModel], 
        model_class: Type[T], 
        required_fields: Optional[List[str]] = None
    ) -> Dict[str, Any]:
        """
        Unwrap and validate parameters.
    
        Args:
            params: The parameters to unwrap and validate. Can be a dictionary or a Pydantic model.
            model_class: The Pydantic model class to validate against.
            required_fields: List of fields that must be present.
    
        Returns:
            A dictionary with success status and validated parameters or error message.
        """
        try:
            # Handle case where params is already a Pydantic model
            if isinstance(params, BaseModel):
                # If it's already the correct model class, use it directly
                if isinstance(params, model_class):
                    model_instance = params
                # Otherwise, convert to dict and create new instance
                else:
                    model_instance = model_class(**params.dict())
            # Handle dictionary case
            else:
                # Create model instance
                model_instance = model_class(**params)
            
            # Check required fields
            if required_fields:
                missing_fields = []
                for field in required_fields:
                    if getattr(model_instance, field, None) is None:
                        missing_fields.append(field)
                
                if missing_fields:
                    return {
                        "success": False,
                        "message": f"Missing required fields: {', '.join(missing_fields)}",
                    }
            
            return {
                "success": True,
                "params": model_instance,
            }
        except Exception as e:
            return {
                "success": False,
                "message": f"Invalid parameters: {str(e)}",
            }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Create a new changeset' implies a write/mutation operation, but the description doesn't disclose any behavioral traits: no information about permissions required, whether this is reversible, what happens on success/failure, rate limits, or what the response contains. For a creation tool with zero annotation coverage, this is a significant gap in behavioral transparency.

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

Conciseness5/5

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

The description is extremely concise at just 6 words. It's front-loaded with the core action and resource. There's zero wasted language or redundancy. While it may be too brief for adequate tool understanding, from a pure conciseness perspective, it's maximally efficient.

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 complexity (creation/mutation operation), lack of annotations, lack of output schema, and multiple sibling tools in the same domain, the description is incomplete. It doesn't explain what a changeset is, how it fits into the ServiceNow workflow, what happens after creation, or what the tool returns. For a mutation tool with no structured safety or behavioral annotations, the description should provide more context about the operation's role and consequences.

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

Parameters1/5

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

The description provides zero information about parameters. With 0% schema description coverage and 4 parameters (name, application, description, developer), the description doesn't add any meaning beyond what the input schema provides. The schema itself has good parameter descriptions, but the tool description doesn't compensate for the lack of schema description coverage or provide any additional context about parameter usage, constraints, or relationships.

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

Purpose3/5

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

The description states 'Create a new changeset in ServiceNow' which clearly indicates the action (create) and resource (changeset). However, it doesn't differentiate from sibling tools like 'update_changeset' or 'commit_changeset', nor does it specify what a changeset is in this context. The purpose is clear but lacks specificity about what distinguishes this creation operation from other changeset-related operations.

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. There are multiple sibling tools related to changesets (create_changeset, update_changeset, commit_changeset, publish_changeset, add_file_to_changeset, get_changeset_details, list_changesets), but the description doesn't indicate when this initial creation step is appropriate versus updating an existing changeset or other operations. No context about prerequisites or workflow sequencing is provided.

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/echelon-ai-labs/servicenow-mcp'

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