Skip to main content
Glama
echelon-ai-labs

ServiceNow MCP Server

get_changeset_details

Retrieve comprehensive details about a specific changeset using the changeset ID. This tool connects to ServiceNow instances via the MCP Server, enabling users to access and analyze changeset information efficiently.

Instructions

Get detailed information about a specific changeset

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The main handler function implementing the logic to retrieve detailed information about a specific changeset, including associated changes, from the ServiceNow API using REST calls.
    def get_changeset_details(
        auth_manager: AuthManager,
        server_config: ServerConfig,
        params: Union[Dict[str, Any], GetChangesetDetailsParams],
    ) -> Dict[str, Any]:
        """
        Get detailed information about a specific changeset.
    
        Args:
            auth_manager: The authentication manager.
            server_config: The server configuration.
            params: The parameters for getting changeset details. Can be a dictionary or a GetChangesetDetailsParams object.
    
        Returns:
            Detailed information about the changeset.
        """
        # Unwrap and validate parameters
        result = _unwrap_and_validate_params(
            params, 
            GetChangesetDetailsParams, 
            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",
            }
        
        # Make the API request
        url = f"{instance_url}/api/now/table/sys_update_set/{validated_params.changeset_id}"
        
        try:
            response = requests.get(url, headers=headers)
            response.raise_for_status()
            
            result = response.json()
            
            # Get the changeset details
            changeset = result.get("result", {})
            
            # Get the changes in this changeset
            changes_url = f"{instance_url}/api/now/table/sys_update_xml"
            changes_params = {
                "sysparm_query": f"update_set={validated_params.changeset_id}",
            }
            
            changes_response = requests.get(changes_url, params=changes_params, headers=headers)
            changes_response.raise_for_status()
            
            changes_result = changes_response.json()
            changes = changes_result.get("result", [])
            
            return {
                "success": True,
                "changeset": changeset,
                "changes": changes,
                "change_count": len(changes),
            }
        except requests.exceptions.RequestException as e:
            logger.error(f"Error getting changeset details: {e}")
            return {
                "success": False,
                "message": f"Error getting changeset details: {str(e)}",
            }
  • Pydantic BaseModel defining the input schema for the get_changeset_details tool, requiring a changeset_id.
    class GetChangesetDetailsParams(BaseModel):
        """Parameters for getting changeset details."""
    
        changeset_id: str = Field(..., description="Changeset ID or sys_id")
  • Tool registration in get_tool_definitions() mapping 'get_changeset_details' to its handler (aliased import), input schema, description, and serialization settings.
    "get_changeset_details": (
        get_changeset_details_tool,
        GetChangesetDetailsParams,
        str,  # Expects JSON string
        "Get detailed information about a specific changeset",
        "json",  # Tool returns list/dict
    ),
  • Import statement exposing get_changeset_details from changeset_tools.py in the tools package __init__.
    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 the handler to unwrap, validate, and parse input parameters against the Pydantic schema.
    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 full burden but only states it 'gets' information, implying a read-only operation. It lacks behavioral details such as authentication requirements, error handling (e.g., for invalid IDs), rate limits, or what happens if the changeset doesn't exist. This is inadequate for a tool with potential complexity.

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 no wasted words. It's front-loaded with the core purpose, making it easy to scan. Every word earns its place, though it could benefit from additional context.

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 no annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't address return values, error conditions, or operational constraints. For a tool that likely returns structured data about changesets, more context is needed to use it effectively.

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

Parameters2/5

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

Schema description coverage is 0%, and the description adds no parameter information beyond implying a 'specific changeset'. It doesn't explain the 'changeset_id' parameter's format, validation rules, or where to obtain it (e.g., from 'list_changesets'). With 1 undocumented parameter, the description fails to compensate for the schema gap.

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 'Get detailed information about a specific changeset' clearly states the verb ('Get') and resource ('changeset'), but it's vague about what 'detailed information' entails. It distinguishes from siblings like 'list_changesets' (which lists multiple) but doesn't specify what details are included beyond the basic concept.

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?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid changeset ID), contrast with 'list_changesets' for browsing, or specify use cases like reviewing changeset metadata before actions like 'update_changeset' or 'publish_changeset'.

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