get_article
Retrieve Document360 knowledge base articles by ID to access titles, content, tags, and metadata for documentation needs.
Instructions
Get article by ID from Document360
Args: article_id: Document360 article ID (UUID string) ctx: MCP context for logging and error handling
Returns: Article information including title, content, tags, and metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| article_id | Yes | Document360 article ID (UUID string) |
Implementation Reference
- inc/tools.py:35-62 (handler)The core handler function that executes the 'get_article' tool logic: fetches article data using Document360 client, provides MCP context logging, and handles specific API errors.async def get_article(article_id: str, ctx: Context) -> Dict[str, Any]: """Get article by ID from Document360 Args: article_id: Document360 article ID (UUID string) ctx: MCP context for logging and error handling Returns: Article data from Document360 API """ try: await ctx.info(f"Fetching article with ID: {article_id}") result = await client.get_article(article_id) await ctx.info(f"Successfully retrieved article: {result.get('data', {}).get('title', 'Unknown')}") return result except Document360APIError as e: await ctx.error(f"Document360 API error: {e.message}") if e.status_code == 404: await ctx.warning(f"Article {article_id} not found") elif e.status_code == 401: await ctx.error("Invalid API key - check configuration") raise e except Exception as e: await ctx.error(f"Unexpected error fetching article: {str(e)}") raise e
- server.py:58-72 (registration)MCP tool registration for 'get_article' using @mcp.tool decorator. Includes input schema via Annotated[str, Field] and docstring. Delegates execution to the handler in inc/tools.py.@mcp.tool async def get_article( article_id: Annotated[str, Field(description="Document360 article ID (UUID string)")], ctx: Context ) -> dict: """Get article by ID from Document360 Args: article_id: Document360 article ID (UUID string) ctx: MCP context for logging and error handling Returns: Article information including title, content, tags, and metadata """ return await tools.get_article(article_id, ctx)
- inc/document360_client.py:62-65 (helper)Supporting utility in Document360Client class that makes the HTTP request to the Document360 API endpoint for retrieving an article by ID.async def get_article(self, article_id: str) -> Dict[str, Any]: """Get article by ID""" return await self._request("GET", f"/Articles/{article_id}/{config.langcode}?isForDisplay=false&isPublished={config.only_published}")