Skip to main content
Glama
JLKmach

ServiceNow MCP Server

by JLKmach

submit_change_for_approval

Submit a change request for approval in ServiceNow by providing the change ID and optional comments to initiate the review process.

Instructions

Submit a change request for approval

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
change_idYesChange request ID or sys_id
approval_commentsNoComments for the approval request

Implementation Reference

  • Main handler function implementing the tool logic: validates params, updates change_request state to 'assess', creates approval record in sysapproval_approver table.
    def submit_change_for_approval(
        auth_manager: AuthManager,
        server_config: ServerConfig,
        params: Dict[str, Any],
    ) -> Dict[str, Any]:
        """
        Submit a change request for approval in ServiceNow.
    
        Args:
            auth_manager: The authentication manager.
            server_config: The server configuration.
            params: The parameters for submitting a change request for approval.
    
        Returns:
            The result of the submission.
        """
        # Unwrap and validate parameters
        result = _unwrap_and_validate_params(
            params, 
            SubmitChangeForApprovalParams,
            required_fields=["change_id"]
        )
        
        if not result["success"]:
            return result
        
        validated_params = result["params"]
        
        # Prepare the request data
        data = {
            "state": "assess",  # Set state to "assess" to submit for approval
        }
        
        # Add approval comments if provided
        if validated_params.approval_comments:
            data["work_notes"] = validated_params.approval_comments
        
        # 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",
            }
        
        # Add Content-Type header
        headers["Content-Type"] = "application/json"
        
        # Make the API request
        url = f"{instance_url}/api/now/table/change_request/{validated_params.change_id}"
        
        try:
            response = requests.patch(url, json=data, headers=headers)
            response.raise_for_status()
            
            # Now, create an approval request
            approval_url = f"{instance_url}/api/now/table/sysapproval_approver"
            approval_data = {
                "document_id": validated_params.change_id,
                "source_table": "change_request",
                "state": "requested",
            }
            
            approval_response = requests.post(approval_url, json=approval_data, headers=headers)
            approval_response.raise_for_status()
            
            approval_result = approval_response.json()
            
            return {
                "success": True,
                "message": "Change request submitted for approval successfully",
                "approval": approval_result["result"],
            }
        except requests.exceptions.RequestException as e:
            logger.error(f"Error submitting change for approval: {e}")
            return {
                "success": False,
                "message": f"Error submitting change for approval: {str(e)}",
            }
  • Pydantic schema defining input parameters for the tool.
    class SubmitChangeForApprovalParams(BaseModel):
        """Parameters for submitting a change request for approval."""
    
        change_id: str = Field(..., description="Change request ID or sys_id")
        approval_comments: Optional[str] = Field(None, description="Comments for the approval request")
  • Registration of the tool in the central tool_definitions dictionary used by the MCP server.
    "submit_change_for_approval": (
        submit_change_for_approval_tool,
        SubmitChangeForApprovalParams,
        str,
        "Submit a change request for approval",
        "str",  # Tool returns simple message
    ),
  • Export of the tool function from the tools package __init__.
    submit_change_for_approval,
  • Import alias for the tool handler used in registration.
    from servicenow_mcp.tools.change_tools import (
        submit_change_for_approval as submit_change_for_approval_tool,
    )

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'submit for approval' but lacks details on behavioral traits: it doesn't specify required permissions, whether this is a mutating operation, what happens after submission (e.g., status change, notifications), or potential side effects. This is inadequate for a tool that likely alters workflow states.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and easy to parse, though it could be slightly more specific (e.g., 'Submit a change request to initiate the approval workflow').

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 (a workflow submission tool with no annotations and no output schema), the description is insufficient. It doesn't explain what the tool returns, error conditions, or behavioral context like state transitions. For a tool that likely involves mutating a change request's approval status, more detail is needed to guide an AI agent effectively.

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?

Schema description coverage is 100%, so the schema fully documents both parameters (change_id and approval_comments). The description adds no additional meaning beyond what's in the schema, such as explaining the purpose of 'change_id' or when to use 'approval_comments'. Baseline 3 is appropriate when the schema handles parameter documentation.

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 'Submit a change request for approval' clearly states the action (submit) and target (change request for approval), but it's somewhat vague about what 'submit' entails (e.g., initiating an approval workflow vs. sending a notification). It doesn't distinguish from siblings like 'approve_change' or 'reject_change', which are related but different actions.

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. For example, it doesn't specify prerequisites (e.g., must be in a draft state), when it's appropriate (e.g., after creating a change request), or contrast with siblings like 'approve_change' or 'reject_change' that handle different approval stages.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools