update_article
Modify an existing ServiceNow knowledge article by updating its title, content, description, category, or keywords using the article ID.
Instructions
Update an existing knowledge article
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"article_id": "<article_id>"
},
"name": "update_article"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| article_id | Yes | ID of the article to update | |
| category | No | Updated category for the article | |
| keywords | No | Updated keywords for search | |
| short_description | No | Updated short description | |
| text | No | Updated main body text for the article. Field supports html formatting and wiki markup based on the article_type. HTML is the default. | |
| title | No | Updated title of the article |
Implementation Reference
- The core handler function that executes the logic to update a knowledge article via a PATCH request to the ServiceNow API.
def update_article( config: ServerConfig, auth_manager: AuthManager, params: UpdateArticleParams, ) -> ArticleResponse: """ Update an existing knowledge article. Args: config: Server configuration. auth_manager: Authentication manager. params: Parameters for updating the article. Returns: Response with the updated article details. """ api_url = f"{config.api_url}/table/kb_knowledge/{params.article_id}" # Build request data data = {} if params.title: data["short_description"] = params.title if params.text: data["text"] = params.text if params.short_description: data["short_description"] = params.short_description if params.category: data["kb_category"] = params.category if params.keywords: data["keywords"] = params.keywords # 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 ArticleResponse( success=True, message="Article updated successfully", article_id=params.article_id, article_title=result.get("short_description"), workflow_state=result.get("workflow_state"), ) except requests.RequestException as e: logger.error(f"Failed to update article: {e}") return ArticleResponse( success=False, message=f"Failed to update article: {str(e)}", ) - Pydantic BaseModel defining the input schema/parameters for the update_article tool.
class UpdateArticleParams(BaseModel): """Parameters for updating a knowledge article.""" article_id: str = Field(..., description="ID of the article to update") title: Optional[str] = Field(None, description="Updated title of the article") text: Optional[str] = Field(None, description="Updated main body text for the article. Field supports html formatting and wiki markup based on the article_type. HTML is the default.") short_description: Optional[str] = Field(None, description="Updated short description") category: Optional[str] = Field(None, description="Updated category for the article") keywords: Optional[str] = Field(None, description="Updated keywords for search") - src/servicenow_mcp/utils/tool_utils.py:736-742 (registration)Tool registration entry in get_tool_definitions() mapping the tool name to its handler, schema, return type, description, and serialization method.
"update_article": ( update_article_tool, UpdateArticleParams, str, # Expects JSON string "Update an existing knowledge article", "json_dict", # Tool returns Pydantic model ), - src/servicenow_mcp/tools/__init__.py:57-57 (registration)Re-export of the update_article function for convenient import from the tools package.
update_article, - src/servicenow_mcp/utils/tool_utils.py:176-177 (registration)Import of the update_article handler aliased as update_article_tool for use in tool registration.
from servicenow_mcp.tools.knowledge_base import ( update_article as update_article_tool,