Skip to main content
Glama

search_files

Read-only

Search Google Drive files by name or content across My Drive and accessible shared drives, with optional folder and MIME type filters.

Instructions

Search for files in Google Drive by name or content. Without folder_id, searches 'My Drive' AND every shared drive the authenticated account can access (corpora='allDrives').

For a spreadsheet-only search, search_spreadsheets(query, max_results) is a narrower convenience wrapper around this same query pre-filtered to the spreadsheet MIME type.

Args: query: Search string matched against file name and full text. mime_type: Optional MIME type filter, e.g. 'application/vnd.google-apps.document', 'application/vnd.google-apps.spreadsheet', 'application/pdf'. folder_id: Optional folder to restrict the search to. max_results: Maximum results to return (default 20, max 100).

Returns: List of matching files with id, name, mimeType, modified time, owners, parent folder, webViewLink, and starred status. Trashed files are excluded; to find one to restore, use get_file_metadata or restore_file with its file ID.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "search_files"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes
folder_idNo
mime_typeNo
max_resultsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv0.9.6
    • removedInput schema / properties / modified_within_days
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "integer"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Modified Within Days"
      -}
    • removedInput schema / properties / order_by
      Removed value: -{
      -  "default": "modified",
      -  "enum": [
      -    "modified",
      -    "name"
      -  ],
      -  "title": "Order By",
      -  "type": "string"
      -}
    • removedInput schema / properties / query / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / query / default
      Removed value: -null
    • addedInput schema / properties / query / type
      Added value: +"string"
    • removedInput schema / properties / shared_with_me
      Removed value: -{
      -  "default": false,
      -  "title": "Shared With Me",
      -  "type": "boolean"
      -}
    • addedInput schema / required
      Added value: +[
      +  "query"
      +]
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / properties
      Added value: +{
      +  "result": {
      +    "items": {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    "title": "Result",
      +    "type": "array"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "result"
      +]
    • changedOutput schema / title
      Previous value: -"search_filesDictOutput"New value: +"search_filesOutput"
  2. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so safety is covered. The description adds genuinely non-obvious behavior: the implicit corpora='allDrives' search scope and the fact that trashed files are excluded from results, plus a redirect for how to find them. The Returns section partially duplicates the output schema, which keeps this from a 5.

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 scope and sibling differentiation are front-loaded in the first two paragraphs, before the docstring-style Args/Returns blocks. The Returns block restates fields already present in the output schema, which is the only real redundancy; otherwise sentences earn their place.

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

Completeness5/5

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

For a four-parameter search tool with no schema descriptions, the definition covers search scope, all parameter meanings and limits, result field contents, trashed-file exclusion, and the two alternative tools for adjacent needs. An agent has everything required to call it correctly on the first attempt.

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

Parameters5/5

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

Schema coverage is 0%, so the description carries the full burden and does: query is matched against file name and full text, mime_type is shown with three concrete MIME examples, folder_id restricts scope, and max_results states both default 20 and the 100 ceiling that the schema does not express.

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

Purpose5/5

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

States a specific verb and resource ('Search for files in Google Drive by name or content') and immediately narrows scope: without folder_id it searches My Drive plus every accessible shared drive. It also explicitly distinguishes itself from the sibling search_spreadsheets wrapper, so an agent can choose between them without opening either schema.

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

Usage Guidelines5/5

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

Gives explicit routing: use search_spreadsheets for spreadsheet-only queries, and use get_file_metadata or restore_file when the target file is trashed. It also states the default scope when folder_id is omitted, so the agent knows the behavioral consequences of each calling pattern.

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

Deploy Server

Other Tools