get_article
Retrieve a specific article from Document360 using its unique ID. Access title, content, tags, and metadata.
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
| Name | Required | Description | Default |
|---|---|---|---|
| article_id | Yes | Document360 article ID (UUID string) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:57-71 (registration)Tool registration with @mcp.tool decorator - defines the get_article tool interface including argument schema (article_id as UUID string), docstring, and delegates to inc/tools.py handler
@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/tools.py:35-62 (handler)Handler function that executes the get_article tool logic - calls the Document360 client, handles logging of success/failure, and manages Document360APIError exceptions with specific error messaging
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 - inc/document360_client.py:62-64 (helper)API client helper method that makes the actual HTTP GET request to Document360's /v2/Articles/{article_id}/{langcode} endpoint with query params for display mode and publish status
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}") - inc/config.py:4-25 (schema)Configuration schema providing langcode and only_published settings used by the get_article API helper to construct the request URL
class Config: """Configuration for Document360 MCP Server""" def __init__(self): self.api_key = os.getenv("DOCUMENT360_API_KEY", "") self.base_url = os.getenv("DOCUMENT360_BASE_URL", "https://apihub.document360.io") self.timeout = int(os.getenv("DOCUMENT360_TIMEOUT", "30")) self.langcode = os.getenv("DOCUMENT360_LANGCODE", "en") self.only_published = os.getenv("DOCUMENT360_ONLYPUBLISHED", "true") def validate(self) -> bool: """Validate configuration""" return bool(self.api_key and self.base_url) @property def headers(self) -> dict: """Return headers for Document360 API requests""" return { "api_token": self.api_key, "Content-Type": "application/json", "User-Agent": "Document360-MCP-Server/1.0" }