search_files
Search files by metadata filters like filename, type, status, or date range to locate documents in projects. Supports pagination for efficient results management.
Instructions
Search files using metadata filters. Supports filters like filename, mime_type, processing_status, upload date range.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tenant_id | Yes | ||
| project_id | Yes | ||
| filters | No | ||
| page | No | ||
| page_size | No |
Implementation Reference
- src/tools/search_files.py:5-32 (handler)The main handler function that implements the search_files tool logic. It accepts tenant_id, project_id, filters, page, and page_size parameters and returns a paginated list of file summaries with metadata. Currently returns a mock/placeholder response.
def search_files( tenant_id: str, project_id: str, filters: dict[str, Any] | None = None, page: int = 1, page_size: int = 20, ) -> dict[str, Any]: """ Search files using metadata filters. Args: tenant_id: Tenant context project_id: Project context filters: Optional filters (filename, mime_type, processing_status, etc.) page: Page number for pagination page_size: Number of results per page Returns: List of file summaries and pagination info (placeholder) """ # Phase 1: Mock response. Phase 2: Query via PostgreSQL provider. return { "files": [], "total_count": 0, "page": page, "page_size": page_size, "has_more": False, } - src/tools/__init__.py:21-30 (registration)Registration of the search_files tool with the MCP server using @mcp.tool decorator. The wrapper function search_files_tool delegates to the imported search_files handler function.
@mcp.tool(name="search_files") def search_files_tool( tenant_id: str, project_id: str, filters: dict | None = None, page: int = 1, page_size: int = 20, ) -> dict: """Search files using metadata filters. Supports filters like filename, mime_type, processing_status, upload date range.""" return search_files(tenant_id, project_id, filters, page, page_size) - src/tools/search_files.py:1-4 (schema)Module docstring and type import for the search_files tool. Defines the input/output types using Python typing (Any) for the filters dict parameter.
"""search_files tool - Search files using metadata filters.""" from typing import Any