box_search_tool
Search for files in Box using specific query, file extensions, and content types. Filter results by folder IDs to locate precise information across names, descriptions, content, comments, or tags.
Instructions
Search for files in Box with the given query.
Args: query (str): The query to search for. file_extensions (List[str]): The file extensions to search for, for example *.pdf content_types (List[SearchForContentContentTypes]): where to look for the information, possible values are: NAME DESCRIPTION, FILE_CONTENT, COMMENTS, TAG, ancestor_folder_ids (List[str]): The ancestor folder IDs to search in. return: List[dict]: The search results.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ancestor_folder_ids | No | ||
| file_extensions | No | ||
| query | Yes | ||
| where_to_look_for_query | No |
Implementation Reference
- src/tools/box_tools_search.py:13-50 (handler)The core handler function implementing the box_search_tool logic. It retrieves a Box client, converts parameters, calls the underlying box_search function, and formats the results as a list of dictionaries.async def box_search_tool( ctx: Context, query: str, file_extensions: List[str] | None = None, where_to_look_for_query: List[str] | None = None, ancestor_folder_ids: List[str] | None = None, ) -> List[dict]: """ Search for files in Box with the given query. Args: query (str): The query to search for. file_extensions (List[str]): The file extensions to search for, for example *.pdf content_types (List[SearchForContentContentTypes]): where to look for the information, possible values are: NAME DESCRIPTION, FILE_CONTENT, COMMENTS, TAG, ancestor_folder_ids (List[str]): The ancestor folder IDs to search in. return: List[dict]: The search results. """ box_client = get_box_client(ctx) # Convert the where to look for query to content types content_types: List[SearchForContentContentTypes] = [] if where_to_look_for_query: for content_type in where_to_look_for_query: content_types.append(SearchForContentContentTypes[content_type]) # Search for files with the query search_results = box_search( box_client, query, file_extensions, content_types, ancestor_folder_ids ) return [search_result.to_dict() for search_result in search_results]
- src/tool_registry/search_tools.py:9-12 (registration)Registers the box_search_tool (and related folder tool) with the FastMCP server using the mcp.tool() decorator.def register_search_tools(mcp: FastMCP): mcp.tool()(box_search_tool) mcp.tool()(box_search_folder_by_name_tool)