search_in_project
Search within a Document360 project version to find related articles and categories.
Instructions
Search inside a project version and return related articles/categories in Document360
Args: project_version_id: Document360 project version ID (UUID string) ctx: MCP context for logging and error handling
Returns: List of hits (articles/categories) from the project version search endpoint
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_version_id | Yes | Document360 project version ID (UUID string) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- inc/tools.py:65-90 (handler)The main handler function that executes the search_in_project tool logic. It calls client.search_project_version() and returns the hits from the result.
async def search_in_project(project_version_id: str, ctx: Context) -> Dict[str, Any]: """Search inside a project version and return hits Args: project_version_id: Document360 project version ID (UUID string) ctx: MCP context for logging and error handling Returns: The raw response from /v2/ProjectVersions/{projectVersionId}/{langCode}, typically contains 'data.hits' """ try: await ctx.info(f"Searching in project version: {project_version_id}") result = await client.search_project_version(project_version_id) hits = result.get('data', {}).get('hits', []) await ctx.info(f"Found {len(hits)} hits in project version {project_version_id}") return {'data': hits, 'success': True} except Document360APIError as e: await ctx.error(f"Document360 API error during project search: {e.message}") raise e except Exception as e: await ctx.error(f"Unexpected error during project search: {str(e)}") raise e - server.py:73-87 (registration)MCP tool registration in server.py using @mcp.tool decorator. Defines the tool's schema (project_version_id parameter) and delegates to tools.search_in_project().
@mcp.tool async def search_in_project( project_version_id: Annotated[str, Field(description="Document360 project version ID (UUID string)")], ctx: Context ) -> dict: """Search inside a project version and return related articles/categories in Document360 Args: project_version_id: Document360 project version ID (UUID string) ctx: MCP context for logging and error handling Returns: List of hits (articles/categories) from the project version search endpoint """ return await tools.search_in_project(project_version_id, ctx) - inc/document360_client.py:78-84 (helper)The underlying API client method search_project_version() that calls GET /v2/ProjectVersions/{projectVersionId}/{langCode} on the Document360 API.
async def search_project_version(self, project_version_id: str) -> Dict[str, Any]: """Search inside a project version (returns hits and metadata) Uses the /v2/ProjectVersions/{projectVersionId}/{langCode} endpoint which returns search hits (articles/categories) for the given project version. """ return await self._request("GET", f"/ProjectVersions/{project_version_id}/{config.langcode}")