Skip to main content
Glama
javerthl

ServiceNow MCP Server

by javerthl

publish_changeset

Publish a ServiceNow changeset to deploy configuration updates from development to production environments, with optional notes for tracking.

Instructions

Publish a changeset in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
changeset_idYesChangeset ID or sys_id
publish_notesNoNotes for publishing

Implementation Reference

  • The main handler function that executes the publish_changeset tool. It validates parameters, retrieves instance URL and headers, prepares a PATCH request to set the changeset state to 'published', and returns success or error details.
    def publish_changeset(
        auth_manager: AuthManager,
        server_config: ServerConfig,
        params: Union[Dict[str, Any], PublishChangesetParams],
    ) -> Dict[str, Any]:
        """
        Publish a changeset in ServiceNow.
    
        Args:
            auth_manager: The authentication manager.
            server_config: The server configuration.
            params: The parameters for publishing a changeset. Can be a dictionary or a PublishChangesetParams object.
    
        Returns:
            The published changeset.
        """
        # Unwrap and validate parameters
        result = _unwrap_and_validate_params(
            params, 
            PublishChangesetParams, 
            required_fields=["changeset_id"]
        )
        
        if not result["success"]:
            return result
        
        validated_params = result["params"]
        
        # 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"
        
        # Prepare the request data for the publish action
        data = {
            "state": "published",
        }
        
        # Add publish notes if provided
        if validated_params.publish_notes:
            data["description"] = validated_params.publish_notes
        
        # Make the API request
        url = f"{instance_url}/api/now/table/sys_update_set/{validated_params.changeset_id}"
        
        try:
            response = requests.patch(url, json=data, headers=headers)
            response.raise_for_status()
            
            result = response.json()
            
            return {
                "success": True,
                "message": "Changeset published successfully",
                "changeset": result["result"],
            }
        except requests.exceptions.RequestException as e:
            logger.error(f"Error publishing changeset: {e}")
            return {
                "success": False,
                "message": f"Error publishing changeset: {str(e)}",
            }
  • Pydantic BaseModel defining the input schema for the publish_changeset tool, with required 'changeset_id' and optional 'publish_notes' fields.
    class PublishChangesetParams(BaseModel):
        """Parameters for publishing a changeset."""
    
        changeset_id: str = Field(..., description="Changeset ID or sys_id")
        publish_notes: Optional[str] = Field(None, description="Notes for publishing")
  • Registration of the 'publish_changeset' tool in the central tool_definitions dictionary used by the MCP server. Maps the tool name to its handler (publish_changeset_tool), input schema (PublishChangesetParams), return type (str), description, and serialization method.
    "publish_changeset": (
        publish_changeset_tool,
        PublishChangesetParams,
        str,
        "Publish a changeset in ServiceNow",
        "str",  # Tool returns simple message
    ),
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Publish' implies a significant state change, but the description doesn't explain what publishing entails - whether it's irreversible, requires approvals, triggers notifications, affects visibility, or has side effects. For a mutation tool with zero annotation coverage, this leaves critical behavioral aspects unspecified.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a tool with only two parameters and gets straight to the point. Every word earns its place, making it easy to parse quickly.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'publish' means operationally, what the expected outcome is, or how this differs from related changeset operations. Given the complexity implied by 'publish' (likely a significant state transition) and the lack of structured metadata, the description should provide more behavioral context.

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

Parameters3/5

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

Schema description coverage is 100%, so both parameters are documented in the schema. The description adds no parameter information beyond what the schema provides. The baseline score of 3 is appropriate when the schema does all the parameter documentation work, though the description could have added context about parameter relationships or usage patterns.

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 'Publish a changeset in ServiceNow' clearly states the action (publish) and resource (changeset) with the platform context (ServiceNow). However, it doesn't differentiate from sibling tools like 'commit_changeset' or 'update_changeset' - the specific meaning of 'publish' versus these alternatives isn't explained. The purpose is understandable but lacks sibling differentiation.

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. With sibling tools like 'commit_changeset' and 'update_changeset' available, there's no indication of the workflow sequence or decision criteria. The description doesn't mention prerequisites, dependencies, or appropriate contexts for publishing versus other changeset operations.

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

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/javerthl/servicenow-mcp'

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