Skip to main content
Glama
vparlapalli490

ServiceNow MCP Server

get_changeset_details

Retrieve detailed information about a specific changeset in ServiceNow using its Changeset ID, enabling efficient tracking and management of updates.

Instructions

Get detailed information about a specific changeset

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
changeset_idYesChangeset ID or sys_id

Implementation Reference

  • Main handler function for the get_changeset_details tool. Fetches changeset details and associated changes from ServiceNow API endpoints sys_update_set and sys_update_xml.
    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 schema/model for input parameters to get_changeset_details, 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 dictionary, mapping name to implementation, params model, description, etc. for MCP server.
    "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 exposing get_changeset_details in tools package __init__.
    get_changeset_details,
  • Helper function to unwrap and validate parameters using Pydantic models, used by get_changeset_details.
    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)}", }

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/vparlapalli490/MCP'

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