Skip to main content
Glama
cindyloo

Dropbox MCP Server

by cindyloo

search_files

Find Dropbox files by name or content across PDF, DOCX, and text formats using search queries to locate specific documents quickly.

Instructions

Search for files in Dropbox by name or content.

Args: query: Search query (searches file names and content) file_types: File types to search ("all", "pdf", "docx", "txt", or comma-separated list) max_results: Maximum number of results to return

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_typesNoall
max_resultsNo
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'search_files' MCP tool. Registered via the @mcp.tool() decorator. Performs filename-based search in Dropbox, filtering by file types, and returns structured SearchResult objects.
    @mcp.tool()
    def search_files(query: str, file_types: str = "all", max_results: int = 10) -> List[SearchResult]:
        """
        Search for files in Dropbox by name or content.
        
        Args:
            query: Search query (searches file names and content)
            file_types: File types to search ("all", "pdf", "docx", "txt", or comma-separated list)
            max_results: Maximum number of results to return
        """
        if not dropbox_client:
            initialize_dropbox_client()
        
        results = []
        extensions = []
        
        # Parse file types
        if file_types.lower() == "all":
            extensions = ['.pdf', '.docx', '.doc', '.txt', '.md', '.py', '.js', '.html', '.css', '.json', '.csv']
        elif file_types.lower() == "pdf":
            extensions = ['.pdf']
        elif file_types.lower() == "docx":
            extensions = ['.docx', '.doc']
        elif file_types.lower() == "txt":
            extensions = ['.txt', '.md']
        else:
            # Comma-separated list
            extensions = [f'.{ext.strip()}' for ext in file_types.split(',')]
        
        try:
            # Search by filename first
            search_result = dropbox_client.files_search_v2(
                query=query,
                options=dropbox.files.SearchOptions(
                    max_results=max_results * 2  # Get more to filter by extension
                )
            )
            
            for match in search_result.matches:
                if len(results) >= max_results:
                    break
                    
                metadata = match.metadata.metadata
                if isinstance(metadata, dropbox.files.FileMetadata):
                    file_path = metadata.path_lower
                    file_name = metadata.name
                    
                    # Check if file extension matches
                    if any(file_path.endswith(ext) for ext in extensions):
                        results.append(SearchResult(
                            file_path=file_path,
                            file_name=file_name,
                            match_context=f"Filename match: {file_name}",
                            file_size=metadata.size,
                            modified=metadata.server_modified.isoformat()
                        ))
            
            return results
            
        except Exception as e:
            raise ValueError(f"Search failed: {e}")
  • Pydantic BaseModel defining the output schema for each search result returned by the search_files tool.
    class SearchResult(BaseModel):
        """Search result structure."""
        file_path: str
        file_name: str
        match_context: str
        file_size: int
        modified: str
  • The @mcp.tool() decorator registers the search_files function as an MCP tool with the name 'search_files' in the FastMCP server.
    @mcp.tool()
  • Duplicate handler for the 'search_files' tool in dockerfile.py (identical implementation).
    @mcp.tool()
    def search_files(query: str, file_types: str = "all", max_results: int = 10) -> List[SearchResult]:
        """
        Search for files in Dropbox by name or content.
        
        Args:
            query: Search query (searches file names and content)
            file_types: File types to search ("all", "pdf", "docx", "txt", or comma-separated list)
            max_results: Maximum number of results to return
        """
        if not dropbox_client:
            initialize_dropbox_client()
        
        results = []
        extensions = []
        
        # Parse file types
        if file_types.lower() == "all":
            extensions = ['.pdf', '.docx', '.doc', '.txt', '.md', '.py', '.js', '.html', '.css', '.json', '.csv']
        elif file_types.lower() == "pdf":
            extensions = ['.pdf']
        elif file_types.lower() == "docx":
            extensions = ['.docx', '.doc']
        elif file_types.lower() == "txt":
            extensions = ['.txt', '.md']
        else:
            # Comma-separated list
            extensions = [f'.{ext.strip()}' for ext in file_types.split(',')]
        
        try:
            # Search by filename first
            search_result = dropbox_client.files_search_v2(
                query=query,
                options=dropbox.files.SearchOptions(
                    max_results=max_results * 2  # Get more to filter by extension
                )
            )
            
            for match in search_result.matches:
                if len(results) >= max_results:
                    break
                    
                metadata = match.metadata.metadata
                if isinstance(metadata, dropbox.files.FileMetadata):
                    file_path = metadata.path_lower
                    file_name = metadata.name
                    
                    # Check if file extension matches
                    if any(file_path.endswith(ext) for ext in extensions):
                        results.append(SearchResult(
                            file_path=file_path,
                            file_name=file_name,
                            match_context=f"Filename match: {file_name}",
                            file_size=metadata.size,
                            modified=metadata.server_modified.isoformat()
                        ))
            
            return results
            
        except Exception as e:
            raise ValueError(f"Search failed: {e}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches for files but does not cover critical aspects like authentication requirements, rate limits, pagination behavior, or error handling. For a search tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with a clear purpose statement, followed by a structured 'Args' section that efficiently lists parameters. Each sentence adds value without redundancy, though it could be slightly more concise by integrating the parameter explanations into the main text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no annotations, but with an output schema), the description is adequate but incomplete. It covers basic functionality and parameters but lacks behavioral details (e.g., search scope, result format hints). The presence of an output schema reduces the need to explain return values, but more context on usage and limitations would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context beyond the input schema, which has 0% schema description coverage. It explains that 'query' searches file names and content, 'file_types' accepts specific values or a comma-separated list, and 'max_results' limits returned results. This compensates well for the lack of schema descriptions, though it could detail format constraints (e.g., query syntax).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches for files in Dropbox by name or content, providing a specific verb ('search') and resource ('files in Dropbox'). However, it does not explicitly differentiate from sibling tools like 'search_file_content' or 'list_files', which may have overlapping functionality, leaving some ambiguity about when to choose this tool over others.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_files' or 'search_file_content'. It mentions searching by name or content but does not specify scenarios, prerequisites, or exclusions, leaving the agent to infer usage from context without explicit direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cindyloo/dropbox-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server