Skip to main content
Glama
JLKmach

ServiceNow MCP Server

by JLKmach

create_catalog_category

Create new service catalog categories in ServiceNow to organize and structure available services for users.

Instructions

Create a new service catalog category.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTitle of the category
descriptionNoDescription of the category
parentNoParent category sys_id
iconNoIcon for the category
activeNoWhether the category is active
orderNoOrder of the category

Implementation Reference

  • The handler function that executes the create_catalog_category tool logic, sending a POST request to the ServiceNow sc_category table API to create a new category.
    def create_catalog_category( config: ServerConfig, auth_manager: AuthManager, params: CreateCatalogCategoryParams, ) -> CatalogResponse: """ Create a new service catalog category in ServiceNow. Args: config: Server configuration auth_manager: Authentication manager params: Parameters for creating a catalog category Returns: Response containing the result of the operation """ logger.info("Creating new service catalog category") # Build the API URL url = f"{config.instance_url}/api/now/table/sc_category" # Prepare request body body = { "title": params.title, } if params.description is not None: body["description"] = params.description if params.parent is not None: body["parent"] = params.parent if params.icon is not None: body["icon"] = params.icon if params.active is not None: body["active"] = str(params.active).lower() if params.order is not None: body["order"] = str(params.order) # Make the API request headers = auth_manager.get_headers() headers["Accept"] = "application/json" headers["Content-Type"] = "application/json" try: response = requests.post(url, headers=headers, json=body) response.raise_for_status() # Process the response result = response.json() category = result.get("result", {}) # Format the response formatted_category = { "sys_id": category.get("sys_id", ""), "title": category.get("title", ""), "description": category.get("description", ""), "parent": category.get("parent", ""), "icon": category.get("icon", ""), "active": category.get("active", ""), "order": category.get("order", ""), } return CatalogResponse( success=True, message=f"Created catalog category: {params.title}", data=formatted_category, ) except requests.exceptions.RequestException as e: logger.error(f"Error creating catalog category: {str(e)}") return CatalogResponse( success=False, message=f"Error creating catalog category: {str(e)}", data=None, )
  • Pydantic model defining the input parameters for the create_catalog_category tool.
    class CreateCatalogCategoryParams(BaseModel): """Parameters for creating a new service catalog category.""" title: str = Field(..., description="Title of the category") description: Optional[str] = Field(None, description="Description of the category") parent: Optional[str] = Field(None, description="Parent category sys_id") icon: Optional[str] = Field(None, description="Icon for the category") active: bool = Field(True, description="Whether the category is active") order: Optional[int] = Field(None, description="Order of the category")
  • Registration of the create_catalog_category tool in the get_tool_definitions dictionary, mapping the tool name to its implementation, params schema, description, and serialization method.
    "create_catalog_category": ( create_catalog_category_tool, CreateCatalogCategoryParams, str, # Expects JSON string "Create a new service catalog category.", "json_dict", # Tool returns Pydantic model ),

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