Skip to main content
Glama
vparlapalli490

ServiceNow MCP Server

update_article

Modify knowledge articles by updating titles, text, categories, or keywords using the ServiceNow MCP Server. Ensure content stays current with targeted edits.

Instructions

Update an existing knowledge article

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
article_idYesID of the article to update
categoryNoUpdated category for the article
keywordsNoUpdated keywords for search
short_descriptionNoUpdated short description
textNoUpdated main body text for the article
titleNoUpdated title of the article

Implementation Reference

  • Main handler function that performs the PATCH request to update the knowledge article in ServiceNow.
    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 model 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") 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")
  • Tool registration in get_tool_definitions() dictionary, specifying the handler function alias, input schema, description, and serialization method for MCP server.
    "update_article": ( update_article_tool, UpdateArticleParams, str, # Expects JSON string "Update an existing knowledge article", "json_dict", # Tool returns Pydantic model
  • Import of update_article function from knowledge_base.py for exposure in tools module.
    update_article,
  • Import alias for the update_article handler used in tool registration.
    update_article as update_article_tool, )

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/vparlapalli490/MCP'

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