Skip to main content
Glama
javerthl

ServiceNow MCP Server

by javerthl

update_incident

Modify existing ServiceNow incidents by updating fields like description, state, priority, assignment, and closure details to reflect current status and progress.

Instructions

Update an existing incident in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigned_toNoUser assigned to the incident
assignment_groupNoGroup assigned to the incident
categoryNoCategory of the incident
close_codeNoClose code for the incident
close_notesNoClose notes to add to the incident
descriptionNoDetailed description of the incident
impactNoImpact of the incident
incident_idYesIncident ID or sys_id
priorityNoPriority of the incident
short_descriptionNoShort description of the incident
stateNoState of the incident
subcategoryNoSubcategory of the incident
urgencyNoUrgency of the incident
work_notesNoWork notes to add to the incident

Implementation Reference

  • Main handler function implementing the update_incident tool. Determines if incident_id is sys_id or number, queries for sys_id if needed, builds update data from params, performs PUT request to ServiceNow API, returns IncidentResponse.
    def update_incident(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: UpdateIncidentParams,
    ) -> IncidentResponse:
        """
        Update an existing incident in ServiceNow.
    
        Args:
            config: Server configuration.
            auth_manager: Authentication manager.
            params: Parameters for updating the incident.
    
        Returns:
            Response with the updated incident details.
        """
        # Determine if incident_id is a number or sys_id
        incident_id = params.incident_id
        if len(incident_id) == 32 and all(c in "0123456789abcdef" for c in incident_id):
            # This is likely a sys_id
            api_url = f"{config.api_url}/table/incident/{incident_id}"
        else:
            # This is likely an incident number
            # First, we need to get the sys_id
            try:
                query_url = f"{config.api_url}/table/incident"
                query_params = {
                    "sysparm_query": f"number={incident_id}",
                    "sysparm_limit": 1,
                }
    
                response = requests.get(
                    query_url,
                    params=query_params,
                    headers=auth_manager.get_headers(),
                    timeout=config.timeout,
                )
                response.raise_for_status()
    
                result = response.json().get("result", [])
                if not result:
                    return IncidentResponse(
                        success=False,
                        message=f"Incident not found: {incident_id}",
                    )
    
                incident_id = result[0].get("sys_id")
                api_url = f"{config.api_url}/table/incident/{incident_id}"
    
            except requests.RequestException as e:
                logger.error(f"Failed to find incident: {e}")
                return IncidentResponse(
                    success=False,
                    message=f"Failed to find incident: {str(e)}",
                )
    
        # Build request data
        data = {}
    
        if params.short_description:
            data["short_description"] = params.short_description
        if params.description:
            data["description"] = params.description
        if params.state:
            data["state"] = params.state
        if params.category:
            data["category"] = params.category
        if params.subcategory:
            data["subcategory"] = params.subcategory
        if params.priority:
            data["priority"] = params.priority
        if params.impact:
            data["impact"] = params.impact
        if params.urgency:
            data["urgency"] = params.urgency
        if params.assigned_to:
            data["assigned_to"] = params.assigned_to
        if params.assignment_group:
            data["assignment_group"] = params.assignment_group
        if params.work_notes:
            data["work_notes"] = params.work_notes
        if params.close_notes:
            data["close_notes"] = params.close_notes
        if params.close_code:
            data["close_code"] = params.close_code
    
        # Make request
        try:
            response = requests.put(
                api_url,
                json=data,
                headers=auth_manager.get_headers(),
                timeout=config.timeout,
            )
            response.raise_for_status()
    
            result = response.json().get("result", {})
    
            return IncidentResponse(
                success=True,
                message="Incident updated successfully",
                incident_id=result.get("sys_id"),
                incident_number=result.get("number"),
            )
    
        except requests.RequestException as e:
            logger.error(f"Failed to update incident: {e}")
            return IncidentResponse(
                success=False,
                message=f"Failed to update incident: {str(e)}",
            )
  • Pydantic BaseModel defining the input parameters (schema) for the update_incident tool, including required incident_id and optional fields for updating.
    class UpdateIncidentParams(BaseModel):
        """Parameters for updating an incident."""
    
        incident_id: str = Field(..., description="Incident ID or sys_id")
        short_description: Optional[str] = Field(None, description="Short description of the incident")
        description: Optional[str] = Field(None, description="Detailed description of the incident")
        state: Optional[str] = Field(None, description="State of the incident")
        category: Optional[str] = Field(None, description="Category of the incident")
        subcategory: Optional[str] = Field(None, description="Subcategory of the incident")
        priority: Optional[str] = Field(None, description="Priority of the incident")
        impact: Optional[str] = Field(None, description="Impact of the incident")
        urgency: Optional[str] = Field(None, description="Urgency of the incident")
        assigned_to: Optional[str] = Field(None, description="User assigned to the incident")
        assignment_group: Optional[str] = Field(None, description="Group assigned to the incident")
        work_notes: Optional[str] = Field(None, description="Work notes to add to the incident")
        close_notes: Optional[str] = Field(None, description="Close notes to add to the incident")
        close_code: Optional[str] = Field(None, description="Close code for the incident")
  • Tool registration in get_tool_definitions() dictionary, mapping 'update_incident' to its handler function (aliased), params schema, return type, description, and serialization method.
    "update_incident": (
        update_incident_tool,
        UpdateIncidentParams,
        str,
        "Update an existing incident in ServiceNow",
        "str",
    ),
  • Import of update_incident handler from incident_tools.py into the tools package __init__, making it available for re-export.
    from servicenow_mcp.tools.incident_tools import (
        add_comment,
        create_incident,
        list_incidents,
        resolve_incident,
        update_incident,
    )
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. While 'Update' implies a mutation operation, the description doesn't address critical behavioral aspects: what permissions are required, whether updates are reversible, how partial updates are handled, what happens to unspecified fields, or what the response contains. For a mutation tool with 14 parameters and no annotation coverage, this is a significant gap.

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 that states the core purpose without any wasted words. It's appropriately sized for a basic tool description and gets straight to the point.

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 (14 parameters, mutation operation) and the absence of both annotations and an output schema, the description is inadequate. It doesn't explain what happens after the update, what the return value contains, or any behavioral constraints. For a tool that modifies critical incident data, more contextual information is needed to help an agent use it correctly.

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?

The input schema has 100% description coverage, with each parameter clearly documented in the schema itself. The description adds no additional parameter semantics beyond what's already in the structured schema. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no parameter information in the description.

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

Purpose4/5

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

The description clearly states the action ('Update') and resource ('an existing incident in ServiceNow'), making the purpose immediately understandable. However, it doesn't differentiate this from sibling tools like 'update_article' or 'update_change_request' beyond specifying the incident resource type.

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 like 'create_incident', 'resolve_incident', or 'list_incidents'. It doesn't mention prerequisites (e.g., needing an existing incident ID) or contextual factors that would help an agent choose between update operations on different resources.

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