Skip to main content
Glama
javerthl

ServiceNow MCP Server

by javerthl

resolve_incident

Close and resolve ServiceNow incidents by providing incident ID, resolution code, and detailed resolution notes to document the solution.

Instructions

Resolve an incident in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
incident_idYesIncident ID or sys_id
resolution_codeYesResolution code for the incident
resolution_notesYesResolution notes for the incident

Implementation Reference

  • Implements the core logic for resolving a ServiceNow incident by looking up the incident by ID or number, setting state to resolved (6), applying close_code and close_notes, and handling API requests.
    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 for the resolve_incident tool.
    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")
  • Registers the resolve_incident tool in the central tool definitions dictionary used by the MCP server, specifying the handler function, input schema, return type, description, and serialization method.
    "resolve_incident": (
        resolve_incident_tool,
        ResolveIncidentParams,
        str,
        "Resolve an incident in ServiceNow",
        "str",
    ),
  • Imports the resolve_incident handler aliased as resolve_incident_tool for use in tool registration.
        resolve_incident as resolve_incident_tool,
    )
  • Re-exports resolve_incident from incident_tools.py to make it available for imports in other modules like tool_utils.py.
    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 for behavioral disclosure. 'Resolve an incident' implies a state-changing write operation, but the description doesn't specify whether this requires specific permissions, whether the resolution is reversible, what happens to related records, or what the typical response looks like. For a mutation tool with zero annotation coverage, this is insufficient.

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 maximally concise - a single sentence with zero wasted words. It's front-loaded with the essential information (verb + resource) and contains no unnecessary elaboration.

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 inadequate. It doesn't explain what 'resolving' means in this context, what happens after resolution, whether there are side effects, or what the tool returns. The combination of a write operation with minimal description creates significant gaps for an AI agent.

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 description provides no parameter information, but the input schema has 100% description coverage, with clear documentation for all three required parameters (incident_id, resolution_code, resolution_notes). The baseline score of 3 is appropriate when the schema does the heavy lifting for parameter documentation.

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 ('Resolve') and resource ('an incident in ServiceNow'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'update_incident' or 'create_incident' - it doesn't specify that this is specifically for marking incidents as resolved rather than general updates.

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 'update_incident' and 'create_incident' available, there's no indication whether this is for final resolution versus intermediate status updates, or what prerequisites might be needed before resolving an incident.

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