get_article
Retrieve specific articles from Document360 knowledge base by providing the article ID to access title, content, tags, and metadata.
Instructions
Get article by ID from Document360
Args: article_id: The Document360 article ID (e.g., 'rtt2a758-82a7-4dd0-a7c7-0a9ad04881d0')
Returns: Article information including title, content, tags, and metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| article_id | Yes |
Implementation Reference
- inc/tools.py:35-62 (handler)Core handler function that executes the get_article tool logic: performs logging via ctx, calls the Document360 client to fetch the article, handles specific API errors (404, 401) and general exceptions.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)Registers the MCP tool named 'get_article' using the @mcp.tool decorator. Defines the input schema with Annotated[str, Field] for article_id and ctx parameters.@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: makes the HTTP GET request to the Document360 API endpoint to retrieve the specific 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}")