Skip to main content
Glama
taylorwilsdon

Google Workspace MCP Server - Control Gmail, Calendar, Docs, Sheets, Slides, Chat, Forms & Drive

search_docs

Find Google Docs by name using the Drive API. Input a query, Google email, and service to retrieve a formatted list of matching documents, streamlining document searches in Google Workspace.

Instructions

Searches for Google Docs by name using Drive API (mimeType filter).

Returns:
    str: A formatted list of Google Docs matching the search query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_sizeNo
queryYes
serviceYes
user_google_emailYes

Implementation Reference

  • Handler and registration for the 'search_docs' tool. Searches Google Docs by name using Drive API, returns formatted list with IDs and links.
    @server.tool()
    @handle_http_errors("search_docs", is_read_only=True, service_type="docs")
    @require_google_service("drive", "drive_read")
    async def search_docs(
        service: Any,
        user_google_email: str,
        query: str,
        page_size: int = 10,
    ) -> str:
        """
        Searches for Google Docs by name using Drive API (mimeType filter).
    
        Returns:
            str: A formatted list of Google Docs matching the search query.
        """
        logger.info(f"[search_docs] Email={user_google_email}, Query='{query}'")
    
        escaped_query = query.replace("'", "\\'")
    
        response = await asyncio.to_thread(
            service.files().list(
                q=f"name contains '{escaped_query}' and mimeType='application/vnd.google-apps.document' and trashed=false",
                pageSize=page_size,
                fields="files(id, name, createdTime, modifiedTime, webViewLink)",
                supportsAllDrives=True,
                includeItemsFromAllDrives=True
            ).execute
        )
        files = response.get('files', [])
        if not files:
            return f"No Google Docs found matching '{query}'."
    
        output = [f"Found {len(files)} Google Docs matching '{query}':"]
        for f in files:
            output.append(
                f"- {f['name']} (ID: {f['id']}) Modified: {f.get('modifiedTime')} Link: {f.get('webViewLink')}"
            )
        return "\n".join(output)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the API used and the return format ('formatted list'), but lacks critical details such as authentication requirements, rate limits, pagination behavior (implied by 'page_size' parameter but not explained), error handling, or whether this is a read-only operation. The description is insufficient for a tool with 4 parameters and no annotation coverage.

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 appropriately concise with two sentences that directly address purpose and return value. It's front-loaded with the core functionality. However, the second sentence about return format could be more specific (e.g., what 'formatted' means).

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?

For a search tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It covers basic purpose and return format but misses parameter explanations, behavioral context, and usage guidelines. Given the complexity and lack of structured documentation, the description should provide more comprehensive guidance to help the agent use the tool effectively.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but fails to do so. It doesn't explain any of the 4 parameters: 'query' (what search syntax?), 'service' (what service?), 'user_google_email' (why needed?), or 'page_size' (how pagination works). The description adds no parameter-specific information beyond what the bare schema provides.

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 verb ('searches') and resource ('Google Docs'), specifying the search method ('by name using Drive API with mimeType filter'). It distinguishes from generic file search tools by focusing specifically on Google Docs, though it doesn't explicitly differentiate from 'search_drive_files' which might have overlapping functionality.

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?

No guidance is provided about when to use this tool versus alternatives like 'search_drive_files' or 'list_docs_in_folder'. The description mentions the search method but doesn't specify use cases, prerequisites, or exclusions, leaving the agent to infer appropriate contexts.

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

Related 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/taylorwilsdon/google_workspace_mcp'

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