Skip to main content
Glama
echelon-ai-labs

ServiceNow MCP Server

resolve_incident

Automate incident resolution in ServiceNow by specifying the incident ID, resolution code, and notes. Streamline workflows and ensure accurate incident closure directly through the ServiceNow MCP Server.

Instructions

Resolve an incident in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The core handler function that implements the logic to resolve a ServiceNow incident. It looks up the incident by ID or number, sets the state to resolved (6), applies resolution code and notes, and updates via API.
    def resolve_incident(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: ResolveIncidentParams,
    ) -> IncidentResponse:
        """
        Resolve an incident in ServiceNow.
    
        Args:
            config: Server configuration.
            auth_manager: Authentication manager.
            params: Parameters for resolving the incident.
    
        Returns:
            Response with the result of the operation.
        """
        # 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 = {
            "state": "6",  # Resolved
            "close_code": params.resolution_code,
            "close_notes": params.resolution_notes,
            "resolved_at": "now",
        }
    
        # 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 resolved successfully",
                incident_id=result.get("sys_id"),
                incident_number=result.get("number"),
            )
    
        except requests.RequestException as e:
            logger.error(f"Failed to resolve incident: {e}")
            return IncidentResponse(
                success=False,
                message=f"Failed to resolve incident: {str(e)}",
            )
  • Pydantic BaseModel defining the input parameters schema for the resolve_incident tool: incident_id (str), resolution_code (str), resolution_notes (str).
    class ResolveIncidentParams(BaseModel):
        """Parameters for resolving an incident."""
    
        incident_id: str = Field(..., description="Incident ID or sys_id")
        resolution_code: str = Field(..., description="Resolution code for the incident")
        resolution_notes: str = Field(..., description="Resolution notes for the incident")
  • MCP tool registration entry in get_tool_definitions() dict, mapping 'resolve_incident' to its aliased handler function, input schema (ResolveIncidentParams), return type hint, description, and serialization method.
    "resolve_incident": (
        resolve_incident_tool,
        ResolveIncidentParams,
        str,
        "Resolve an incident in ServiceNow",
        "str",
    ),
  • Import aliasing the resolve_incident handler as resolve_incident_tool for use in tool registration.
        resolve_incident as resolve_incident_tool,
    )
  • Re-export of resolve_incident from incident_tools.py in the tools package __init__.py for convenient imports.
    from servicenow_mcp.tools.incident_tools import (
        add_comment,
        create_incident,
        list_incidents,
        resolve_incident,
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 the action without disclosing behavioral traits. It doesn't mention permissions required, whether resolution is reversible, side effects, or typical response formats, which is inadequate for a mutation tool.

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 and appropriately sized for the tool's name, though it lacks detail.

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 tool's complexity (a mutation with 3 parameters), no annotations, no output schema, and 0% schema coverage, the description is incomplete. It doesn't provide enough context for safe and effective use, missing critical operational details.

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?

Schema description coverage is 0%, meaning parameters are undocumented in the schema. The description adds no information about the three required parameters (incident_id, resolution_code, resolution_notes), failing 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 'Resolve an incident in ServiceNow' clearly states the action (resolve) and resource (incident), but it's vague about what 'resolve' entails compared to siblings like 'update_incident' or 'create_incident'. It doesn't specify if this is a final closure or status change, making it less distinct.

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 such as 'update_incident' or other incident-related tools. The description lacks context about prerequisites, timing, or exclusions, leaving the agent without usage direction.

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