get_category
Retrieve category details including name, description, articles, and metadata from Document360 knowledge base using a specific category ID.
Instructions
Get category by ID from Document360
Args: category_id: The Document360 category ID (e.g., 'rtt2a758-82a7-4dd0-a7c7-0a9ad04881d0')
Returns: Category information including name, description, articles, and metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category_id | Yes |
Implementation Reference
- server.py:90-104 (handler)MCP tool handler and registration for 'get_category'. Includes input schema via Annotated Field and delegates execution to inc.tools.get_category. This is the primary entrypoint for the tool.@mcp.tool async def get_category( category_id: Annotated[str, Field(description="Document360 category ID (UUID string)")], ctx: Context ) -> dict: """Get category by ID from Document360 Args: category_id: Document360 category ID (UUID string) ctx: MCP context for logging and error handling Returns: Category information including name, description, articles, and metadata """ return await tools.get_category(category_id, ctx)
- server.py:92-92 (schema)Input schema definition for the 'get_category' tool parameter using Pydantic Annotated and Field.category_id: Annotated[str, Field(description="Document360 category ID (UUID string)")],
- inc/tools.py:92-119 (helper)Main helper function implementing get_category logic: performs logging, calls Document360 client, handles API errors specifically.async def get_category(category_id: str, ctx: Context) -> Dict[str, Any]: """Get category by ID from Document360 Args: category_id: Document360 category ID (UUID string) ctx: MCP context for logging and error handling Returns: Category data from Document360 API """ try: await ctx.info(f"Fetching category with ID: {category_id}") result = await client.get_category(category_id) await ctx.info("Successfully retrieved category") return result except Document360APIError as e: await ctx.error(f"Document360 API error: {e.message}") if e.status_code == 404: await ctx.warning(f"Category {category_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 category: {str(e)}") raise e
- inc/document360_client.py:54-56 (helper)Document360Client helper method that makes the actual HTTP GET request to retrieve category data via the /v2/categories/{category_id} endpoint.async def get_category(self, category_id: str) -> Dict[str, Any]: """Get category by ID""" return await self._request("GET", f"/categories/{category_id}")