Skip to main content
Glama
adexltd

MCP Google Suite

by adexltd

drive_search_files

Find files in Google Drive by entering search queries to locate documents, spreadsheets, and other stored content.

Instructions

Search for files in Google Drive

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
page_sizeNoNumber of results to return

Implementation Reference

  • MCP tool handler for drive_search_files that validates input and delegates to DriveService.search_files
    async def _handle_drive_search_files(
        self, context: GoogleWorkspaceContext, arguments: dict
    ) -> Dict[str, Any]:
        """Handle drive search files requests."""
        query = arguments.get("query")
        page_size = arguments.get("page_size", 10)
    
        if not query:
            raise ValueError("Search query is required")
    
        logger.debug(f"Drive search request - Query: {query}, Page Size: {page_size}")
        result = await context.drive.search_files(query=query, page_size=page_size)
        logger.debug(f"Drive search completed - Found {len(result.get('files', []))} files")
        return result
  • JSON schema defining the input parameters for the drive_search_files tool
    types.Tool(
        name="drive_search_files",
        description="Search for files in Google Drive",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {"type": "string", "description": "Search query"},
                "page_size": {
                    "type": "integer",
                    "description": "Number of results to return",
                    "default": 10,
                },
            },
            "required": ["query"],
        },
    ),
  • Dynamic registration of the drive_search_files handler into the tool registry
    for tool in self._get_tools_list():
        handler_name = f"_handle_{tool.name}"
        if hasattr(self, handler_name):
            handler = getattr(self, handler_name)
            self._tool_registry[tool.name] = handler
            logger.debug(f"Registered handler for {tool.name}")
  • Core implementation using Google Drive API to search for files matching the query
    def search_files(self, query: str, page_size: int = 10) -> Dict[str, Any]:
        """Search for files in Google Drive."""
        try:
            results = (
                self.service.files()
                .list(q=query, pageSize=page_size, fields="files(id, name, mimeType, webViewLink)")
                .execute()
            )
    
            return {"success": True, "files": results.get("files", [])}
        except HttpError as error:
            return {"success": False, **self.handle_error(error)}
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 doesn't describe what the search returns (e.g., file metadata, IDs, content snippets), whether it's paginated (implied by 'page_size' parameter but not explained), authentication needs, rate limits, or error conditions. This leaves significant gaps for a search operation.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste—'Search for files in Google Drive' directly conveys the core purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of a search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the search returns (e.g., file list, metadata), how results are structured, or any behavioral traits like pagination or error handling. For a tool with 2 parameters and potential rich output, this leaves too many gaps.

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

Parameters3/5

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

Schema description coverage is 100%, with both parameters ('query' and 'page_size') documented in the schema. The description adds no additional meaning beyond what the schema provides—it doesn't explain search syntax, result formats, or default behaviors. Baseline 3 is appropriate since the schema does the heavy lifting.

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 action ('Search for files') and resource ('in Google Drive'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'drive_create_folder' or 'docs_get_content' which operate on different resources or actions, so it doesn't fully distinguish from all alternatives.

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. With sibling tools like 'docs_get_content' for retrieving document content or 'drive_create_folder' for creating folders, there's no indication of when searching files is appropriate versus other file operations. No exclusions or context are mentioned.

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/adexltd/mcp-google-suite'

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