Skip to main content
Glama
echelon-ai-labs

ServiceNow MCP Server

update_script_include

Modify script includes in ServiceNow by updating access levels, active status, API names, client callability, descriptions, or script content using script include ID or name.

Instructions

Update an existing script include in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • Core handler function implementing the logic to update a ServiceNow script include by first retrieving it, building the update payload, and performing a PATCH request to the API.
    def update_script_include(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: UpdateScriptIncludeParams,
    ) -> ScriptIncludeResponse:
        """Update an existing script include in ServiceNow.
        
        Args:
            config: The server configuration.
            auth_manager: The authentication manager.
            params: The parameters for the request.
            
        Returns:
            A response indicating the result of the operation.
        """
        # First, get the script include to update
        get_params = GetScriptIncludeParams(script_include_id=params.script_include_id)
        get_result = get_script_include(config, auth_manager, get_params)
        
        if not get_result["success"]:
            return ScriptIncludeResponse(
                success=False,
                message=get_result["message"],
            )
            
        script_include = get_result["script_include"]
        sys_id = script_include["sys_id"]
        
        # Build the URL
        url = f"{config.instance_url}/api/now/table/sys_script_include/{sys_id}"
        
        # Build the request body
        body = {}
        
        if params.script is not None:
            body["script"] = params.script
            
        if params.description is not None:
            body["description"] = params.description
            
        if params.api_name is not None:
            body["api_name"] = params.api_name
            
        if params.client_callable is not None:
            body["client_callable"] = str(params.client_callable).lower()
            
        if params.active is not None:
            body["active"] = str(params.active).lower()
            
        if params.access is not None:
            body["access"] = params.access
            
        # If no fields to update, return success
        if not body:
            return ScriptIncludeResponse(
                success=True,
                message=f"No changes to update for script include: {script_include['name']}",
                script_include_id=sys_id,
                script_include_name=script_include["name"],
            )
            
        # Make the request
        headers = auth_manager.get_headers()
        
        try:
            response = requests.patch(
                url,
                json=body,
                headers=headers,
                timeout=30,
            )
            response.raise_for_status()
            
            # Parse the response
            data = response.json()
            
            if "result" not in data:
                return ScriptIncludeResponse(
                    success=False,
                    message=f"Failed to update script include: {script_include['name']}",
                )
                
            result = data["result"]
            
            return ScriptIncludeResponse(
                success=True,
                message=f"Updated script include: {result.get('name')}",
                script_include_id=result.get("sys_id"),
                script_include_name=result.get("name"),
            )
            
        except Exception as e:
            logger.error(f"Error updating script include: {e}")
            return ScriptIncludeResponse(
                success=False,
                message=f"Error updating script include: {str(e)}",
            )
  • Pydantic BaseModel defining the input parameters and validation for the update_script_include tool.
    class UpdateScriptIncludeParams(BaseModel):
        """Parameters for updating a script include."""
        
        script_include_id: str = Field(..., description="Script include ID or name")
        script: Optional[str] = Field(None, description="Script content")
        description: Optional[str] = Field(None, description="Description of the script include")
        api_name: Optional[str] = Field(None, description="API name of the script include")
        client_callable: Optional[bool] = Field(None, description="Whether the script include is client callable")
        active: Optional[bool] = Field(None, description="Whether the script include is active")
        access: Optional[str] = Field(None, description="Access level of the script include")
  • Tool registration entry in get_tool_definitions() mapping the tool name to its handler function alias, input schema, output type, description, and serialization method.
    "update_script_include": (
        update_script_include_tool,
        UpdateScriptIncludeParams,
        ScriptIncludeResponse,  # Expects Pydantic model
        "Update an existing script include in ServiceNow",
        "raw_pydantic",  # Tool returns Pydantic model
    ),
  • Pydantic BaseModel defining the output response structure for script include operations, including update_script_include.
    class ScriptIncludeResponse(BaseModel):
        """Response from script include operations."""
        
        success: bool = Field(..., description="Whether the operation was successful")
        message: str = Field(..., description="Message describing the result")
        script_include_id: Optional[str] = Field(None, description="ID of the affected script include")
        script_include_name: Optional[str] = Field(None, description="Name of the affected script include")
  • Import and alias of the handler function used in tool registration.
    from servicenow_mcp.tools.script_include_tools import (
        update_script_include as update_script_include_tool,
    )
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. 'Update' implies a mutation operation, but the description doesn't disclose what permissions are required, whether the update is atomic/reversible, what happens to unspecified fields, error conditions, or rate limits. For a mutation tool with 7 parameters and zero annotation coverage, this is a significant gap in behavioral context.

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 that states the core purpose without unnecessary words. It's front-loaded with the essential information and contains no redundant phrases. Every word earns its place in this minimal description.

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 7 parameters, no annotations, no output schema, and 0% schema description coverage, the description is severely incomplete. It doesn't explain what constitutes a valid script include ID, what fields can be updated, what the update operation returns, or any behavioral constraints. The agent lacks sufficient context to use this tool effectively.

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?

The description provides zero information about parameters beyond what's implied by the tool name. With 0% schema description coverage and 7 parameters (1 required, 6 optional), the description fails to compensate for the complete lack of parameter documentation in the schema. The agent must rely entirely on parameter names and types without semantic guidance.

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 script include in ServiceNow'), providing specific verb+resource combination. However, it doesn't distinguish this tool from its sibling 'update_article', 'update_catalog_category', etc., which all follow the same 'update [resource]' pattern without indicating what makes script includes unique.

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. There's no mention of prerequisites (e.g., needing an existing script include ID), when to use this versus 'create_script_include' or 'delete_script_include', or what constitutes a valid update scenario. The agent must infer usage from the tool name alone.

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