Skip to main content
Glama
vparlapalli490

ServiceNow MCP Server

publish_article

Publish knowledge articles to make them available to users by setting workflow states and versions in ServiceNow.

Instructions

Publish a knowledge article

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
article_idYesID of the article to publish
workflow_stateNoThe workflow state to setpublished
workflow_versionNoThe workflow version to use

Implementation Reference

  • The handler function that executes the publish_article tool logic by sending a PATCH request to update the article's workflow_state to 'published' or specified state.
    def publish_article(
        config: ServerConfig,
        auth_manager: AuthManager,
        params: PublishArticleParams,
    ) -> ArticleResponse:
        """
        Publish a knowledge article.
    
        Args:
            config: Server configuration.
            auth_manager: Authentication manager.
            params: Parameters for publishing the article.
    
        Returns:
            Response with the published article details.
        """
        api_url = f"{config.api_url}/table/kb_knowledge/{params.article_id}"
    
        # Build request data
        data = {
            "workflow_state": params.workflow_state,
        }
    
        if params.workflow_version:
            data["workflow_version"] = params.workflow_version
    
        # 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 published 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 publish article: {e}")
            return ArticleResponse(
                success=False,
                message=f"Failed to publish article: {str(e)}",
            )
  • Pydantic BaseModel defining the input parameters for the publish_article tool: article_id (required), optional workflow_state (defaults to 'published'), optional workflow_version.
    class PublishArticleParams(BaseModel):
        """Parameters for publishing a knowledge article."""
    
        article_id: str = Field(..., description="ID of the article to publish")
        workflow_state: Optional[str] = Field("published", description="The workflow state to set")
        workflow_version: Optional[str] = Field(None, description="The workflow version to use")
  • Registration entry in the tool_definitions dictionary that associates the 'publish_article' tool name with its handler (publish_article_tool), input schema (PublishArticleParams), description, and serialization settings.
    "publish_article": (
        publish_article_tool,
        PublishArticleParams,
        str,  # Expects JSON string
        "Publish a knowledge article",
        "json_dict",  # Tool returns Pydantic model
  • The tool name 'publish_article' listed in the __all__ export list in tools/__init__.py.
    "publish_article",
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. 'Publish' implies a mutation (likely changing an article's state to live), but the description doesn't disclose critical behavioral traits such as permissions required, whether it's idempotent, what happens on failure, or if it triggers notifications. This is a significant gap for a mutation tool with zero annotation coverage.

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 waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration, making it easy to parse quickly.

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 complexity (a mutation operation with no output schema and no annotations), the description is incomplete. It doesn't cover behavioral aspects like side effects, error handling, or return values, which are crucial for an agent to use it correctly. The high schema coverage doesn't compensate for these missing contextual details.

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 100%, so the schema already documents all three parameters (article_id, workflow_state, workflow_version) with descriptions. The description adds no additional meaning beyond the schema, such as explaining default behaviors or interactions between parameters, which aligns with the baseline score when schema does the heavy lifting.

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

Purpose3/5

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

The description 'Publish a knowledge article' clearly states the verb ('publish') and resource ('knowledge article'), which is better than a tautology. However, it lacks specificity about what publishing entails (e.g., making it live, changing its state) and doesn't distinguish it from siblings like 'update_article' or 'create_article', making it somewhat vague.

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 prerequisites (e.g., an article must exist), exclusions, or how it differs from similar tools like 'update_article' or 'activate_workflow', leaving the agent to infer usage from context alone.

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

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