Skip to main content
Glama
JLKmach

ServiceNow MCP Server

by JLKmach

update_catalog_item_variable

Modify catalog item variables in ServiceNow by updating labels, requirements, help text, default values, and display order to improve service request forms.

Instructions

Update a catalog item variable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variable_idYesThe sys_id of the variable to update
labelNoThe display label for the variable
mandatoryNoWhether the variable is required
help_textNoHelp text to display with the variable
default_valueNoDefault value for the variable
descriptionNoDescription of the variable
orderNoDisplay order of the variable
reference_qualifierNoFor reference fields, the query to filter reference options
max_lengthNoMaximum length for string fields
minNoMinimum value for numeric fields
maxNoMaximum value for numeric fields

Implementation Reference

  • The core implementation of the update_catalog_item_variable tool. This function builds a PATCH request to the ServiceNow item_option_new table endpoint, including only provided update fields, handles the API call, and returns a structured response.
    def update_catalog_item_variable(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: UpdateCatalogItemVariableParams,
    ) -> CatalogItemVariableResponse:
        """
        Update an existing variable (form field) for a catalog item.
    
        Args:
            config: Server configuration.
            auth_manager: Authentication manager.
            params: Parameters for updating a catalog item variable.
    
        Returns:
            Response with information about the updated variable.
        """
        api_url = f"{config.instance_url}/api/now/table/item_option_new/{params.variable_id}"
    
        # Build request data with only parameters that are provided
        data = {}
        
        if params.label is not None:
            data["question_text"] = params.label
        if params.mandatory is not None:
            data["mandatory"] = str(params.mandatory).lower()  # ServiceNow expects "true"/"false" strings
        if params.help_text is not None:
            data["help_text"] = params.help_text
        if params.default_value is not None:
            data["default_value"] = params.default_value
        if params.description is not None:
            data["description"] = params.description
        if params.order is not None:
            data["order"] = params.order
        if params.reference_qualifier is not None:
            data["reference_qual"] = params.reference_qualifier
        if params.max_length is not None:
            data["max_length"] = params.max_length
        if params.min is not None:
            data["min"] = params.min
        if params.max is not None:
            data["max"] = params.max
    
        # If no fields to update, return early
        if not data:
            return CatalogItemVariableResponse(
                success=False,
                message="No update parameters provided",
            )
    
        # Make request
        try:
            response = requests.patch(
                api_url,
                json=data,
                headers=auth_manager.get_headers(),
                timeout=config.timeout,
            )
            response.raise_for_status()
    
            result = response.json().get("result", {})
    
            return CatalogItemVariableResponse(
                success=True,
                message="Catalog item variable updated successfully",
                variable_id=params.variable_id,
                details=result,
            )
    
        except requests.RequestException as e:
            logger.error(f"Failed to update catalog item variable: {e}")
            return CatalogItemVariableResponse(
                success=False,
                message=f"Failed to update catalog item variable: {str(e)}",
            ) 
  • Pydantic model defining the input schema for the update_catalog_item_variable tool, validating parameters like variable_id (required) and optional update fields.
    class UpdateCatalogItemVariableParams(BaseModel):
        """Parameters for updating a catalog item variable."""
    
        variable_id: str = Field(..., description="The sys_id of the variable to update")
        label: Optional[str] = Field(None, description="The display label for the variable")
        mandatory: Optional[bool] = Field(None, description="Whether the variable is required")
        help_text: Optional[str] = Field(None, description="Help text to display with the variable")
        default_value: Optional[str] = Field(None, description="Default value for the variable")
        description: Optional[str] = Field(None, description="Description of the variable")
        order: Optional[int] = Field(None, description="Display order of the variable")
        reference_qualifier: Optional[str] = Field(None, description="For reference fields, the query to filter reference options")
        max_length: Optional[int] = Field(None, description="Maximum length for string fields")
        min: Optional[int] = Field(None, description="Minimum value for numeric fields")
        max: Optional[int] = Field(None, description="Maximum value for numeric fields")
  • The registration entry in get_tool_definitions() that associates the tool name 'update_catalog_item_variable' with its handler function (aliased as update_catalog_item_variable_tool), input schema, return type hint, description, and output serialization method.
    "update_catalog_item_variable": (
        update_catalog_item_variable_tool,
        UpdateCatalogItemVariableParams,
        Dict[str, Any],  # Expects dict
        "Update a catalog item variable",
        "dict",  # Tool returns Pydantic model
    ),
  • Import of the update_catalog_item_variable function into the tools package __init__.py, making it available for export via __all__.
    from servicenow_mcp.tools.catalog_variables import (
        create_catalog_item_variable,
        list_catalog_item_variables,
        update_catalog_item_variable,
    )
  • Inclusion of 'update_catalog_item_variable' in the __all__ list of tools/__init__.py, explicitly exporting the tool function from the package.
    "create_catalog_item_variable",
    "list_catalog_item_variables",
    "update_catalog_item_variable",
Behavior1/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. 'Update a catalog item variable' implies a mutation operation but reveals nothing about permissions required, whether changes are reversible, what happens to unspecified fields, error conditions, or response format. For a tool that modifies data with 11 parameters, this lack of behavioral context is critically inadequate.

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. While this conciseness comes at the cost of completeness, the description is perfectly structured and front-loaded with the essential action. Every word earns its place, even if that place is minimal.

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 (11 parameters, mutation operation) and the absence of both annotations and an output schema, the description is severely incomplete. It doesn't explain what a catalog item variable is, what fields can be updated, what the tool returns, or any behavioral aspects. For a tool with this level of complexity and no structured safety information, the description should provide much more context.

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 schema description coverage is 100%, with each parameter well-documented in the input schema. The description adds no parameter information beyond what's already in the schema, so it doesn't compensate but also doesn't detract. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even with no param info in the description.

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

Purpose2/5

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

The description 'Update a catalog item variable' is essentially a tautology that restates the tool name with minimal elaboration. It specifies the verb ('update') and resource ('catalog item variable'), but provides no additional context about what a catalog item variable is or what aspects can be updated. Compared to sibling tools like 'list_catalog_item_variables' or 'create_catalog_item_variable', it doesn't distinguish itself beyond the basic action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides absolutely no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing variable_id), when not to use it, or how it relates to sibling tools like 'create_catalog_item_variable' or 'list_catalog_item_variables'. An agent would have to infer usage purely from the tool name and schema.

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/JLKmach/servicenow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server