Skip to main content
Glama
echelon-ai-labs

ServiceNow MCP Server

get_article

Retrieve a specific knowledge article by its ID using the ServiceNow API to access and manage article data efficiently.

Instructions

Get a specific knowledge article by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • The handler function implementing the get_article tool logic, which retrieves a specific knowledge article from ServiceNow by ID.
    def get_article(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: GetArticleParams,
    ) -> Dict[str, Any]:
        """
        Get a specific knowledge article by ID.
    
        Args:
            config: Server configuration.
            auth_manager: Authentication manager.
            params: Parameters for getting the article.
    
        Returns:
            Dictionary with article details.
        """
        api_url = f"{config.api_url}/table/kb_knowledge/{params.article_id}"
    
        # Build query parameters
        query_params = {
            "sysparm_display_value": "true",
        }
    
        # Make request
        try:
            response = requests.get(
                api_url,
                params=query_params,
                headers=auth_manager.get_headers(),
                timeout=config.timeout,
            )
            response.raise_for_status()
    
            # Get the JSON response
            json_response = response.json()
            
            # Safely extract the result
            if isinstance(json_response, dict) and "result" in json_response:
                result = json_response.get("result", {})
            else:
                logger.error("Unexpected response format: %s", json_response)
                return {
                    "success": False,
                    "message": "Unexpected response format",
                }
    
            if not result or not isinstance(result, dict):
                return {
                    "success": False,
                    "message": f"Article with ID {params.article_id} not found",
                }
    
            # Extract values safely
            article_id = result.get("sys_id", "")
            title = result.get("short_description", "")
            text = result.get("text", "")
            
            # Extract nested values safely
            knowledge_base = ""
            if isinstance(result.get("kb_knowledge_base"), dict):
                knowledge_base = result["kb_knowledge_base"].get("display_value", "")
            
            category = ""
            if isinstance(result.get("kb_category"), dict):
                category = result["kb_category"].get("display_value", "")
            
            workflow_state = ""
            if isinstance(result.get("workflow_state"), dict):
                workflow_state = result["workflow_state"].get("display_value", "")
            
            author = ""
            if isinstance(result.get("author"), dict):
                author = result["author"].get("display_value", "")
            
            keywords = result.get("keywords", "")
            article_type = result.get("article_type", "")
            views = result.get("view_count", "0")
            created = result.get("sys_created_on", "")
            updated = result.get("sys_updated_on", "")
    
            article = {
                "id": article_id,
                "title": title,
                "text": text,
                "knowledge_base": knowledge_base,
                "category": category,
                "workflow_state": workflow_state,
                "created": created,
                "updated": updated,
                "author": author,
                "keywords": keywords,
                "article_type": article_type,
                "views": views,
            }
    
            return {
                "success": True,
                "message": "Article retrieved successfully",
                "article": article,
            }
    
        except requests.RequestException as e:
            logger.error(f"Failed to get article: {e}")
            return {
                "success": False,
                "message": f"Failed to get article: {str(e)}",
            }
  • Pydantic model defining the input parameters for the get_article tool.
    class GetArticleParams(BaseModel):
        """Parameters for getting a knowledge article."""
    
        article_id: str = Field(..., description="ID of the article to get")
  • Registration of the get_article tool in the central tool definitions dictionary, mapping name to function, params, return type, description, and serialization.
    "get_article": (
        get_article_tool,
        GetArticleParams,
        Dict[str, Any],  # Expects dict
        "Get a specific knowledge article by ID",
        "raw_dict",  # Tool returns raw dict
    ),
  • Exposure of get_article in the tools __init__.py __all__ list for easy import.
    "get_article",
  • Import alias for get_article used in tool registration.
        get_article as get_article_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. It states the action ('Get') but doesn't describe what 'Get' entails—whether it returns full content, metadata, permissions needed, error handling, or if it's a read-only operation. For a retrieval tool with zero annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place, achieving optimal conciseness for this simple tool.

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 tool's simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It lacks details on return values, error cases, permissions, or how it differs from siblings like 'list_articles'. For a basic retrieval tool, more context is needed to fully guide an agent, especially without annotations or output schema.

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?

Schema description coverage is 0%, so the description must compensate for parameter documentation. It mentions 'by ID', which aligns with the 'article_id' parameter in the schema, adding minimal semantic context. However, it doesn't explain the ID format, source, or constraints, leaving the parameter only partially clarified beyond the schema's basic structure.

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 tool's purpose with a specific verb ('Get') and resource ('knowledge article by ID'), making it immediately understandable. However, it doesn't explicitly distinguish this from sibling tools like 'list_articles' or 'get_catalog_item', which would require more specific differentiation to achieve a perfect score.

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. It doesn't mention sibling tools like 'list_articles' for browsing or 'get_catalog_item' for similar retrieval operations, nor does it specify prerequisites such as needing an existing article ID. This leaves the agent without contextual usage direction.

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