search_files
Searches and lists files and folders: id, name, mimeType, size, parents, driveId, modifiedTime, trashed, starred, webViewLink and shortcutDetails per file, plus nextPageToken. The convenience filters (name_contains, full_text_contains, mime_type, parent_id, only_folders) are AND-ed together and w...
This record as markdown: /tools/a1-x-tech-mcp-google-drive/search-files.md
What search_files does on Mcp Google Drive
AI agents call search_files to retrieve information from Mcp Google Drive without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | — | Raw Drive search expression (q syntax), AND-ed with the other filters, e.g. "modifiedTime > '2026-01-01T00:00:00' and not name contains 'draft'". |
drive_id | string | — | Search only this shared drive. |
order_by | string | — | Sort keys: createdTime, folder, modifiedTime, name, quotaBytesUsed, recency, starred; add ' desc' to reverse, e.g. 'modifiedTime desc,name'. |
mime_type | string | — | Exact mimeType, e.g. application/pdf, application/vnd.google-apps.document (Google Doc), application/vnd.google-apps.spreadsheet (Google Sheet). |
page_size | integer | — | Files per page (1..1000; API default 100). |
parent_id | string | — | Only direct children of this folder ('root' = My Drive top level). |
page_token | string | — | nextPageToken from the previous page. |
only_folders | boolean | — | Only folders (mimeType application/vnd.google-apps.folder). |
name_contains | string | — | Substring match on the file name (case-insensitive prefix matching per word). |
include_trashed | boolean | — | Include trashed files (default false — the trash is a separate view, as in the Drive UI). |
full_text_contains | string | — | Full-text match over the file's content and description. |
include_all_drives | boolean | — | Search My Drive and every shared drive together (slower; ignored when drive_id is set). |
Parameters from the server's own tool schema.
Why search_files is rated Low
Even though search_files only reads data, uncontrolled read access leaks sensitive information and racks up API costs: an agent caught in a retry loop can make thousands of calls a minute without anyone noticing.
Risk signalsHigh parameter count (12 properties) · Admin/system-level operation
Attacks that exploit this kind of access
The rule that runs search_files safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Mcp Google Drive, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For search_files, this is the rule to start with:
search_files is read-only, so it stays allowed. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Mcp Google Drive, apply this rule, and every search_files call is checked against it from then on.
Questions about search_files
Searches and lists files and folders: id, name, mimeType, size, parents, driveId, modifiedTime, trashed, starred, webViewLink and shortcutDetails per file, plus nextPageToken. The convenience filters (name_contains, full_text_contains, mime_type, parent_id, only_folders) are AND-ed together and with the raw Drive query expression (q syntax, e.g. "modifiedTime > '2026-01-01T00:00:00'"). Trashed files are hidden unless include_trashed=true. Names are NOT unique in Drive — expect several hits and pick by id. parent_id lists a folder's direct children (use 'root' for My Drive's top level). Shared drives: pass drive_id to search one drive, or include_all_drives=true to search everything at once. Paginate with page_token; order_by e.g. 'modifiedTime desc,name'. incompleteSearch=true in the result means some corpora were skipped — narrow the search. It is categorised as a Read tool in the Mcp Google Drive MCP Server, which means it retrieves data without modifying state.
search_files accepts 12 parameters: query, drive_id, order_by, mime_type, page_size, parent_id, page_token, only_folders, name_contains, include_trashed, full_text_contains, include_all_drives. The full parameter table on this page comes from the server's own tool schema.
Register the Mcp Google Drive MCP server in PolicyLayer and add a rule for search_files: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Mcp Google Drive. Nothing to install.
search_files is a Read tool with low risk. Read-only tools are generally safe to allow by default.
Yes. Add a rate_limit block to the search_files rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for search_files. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
search_files is provided by the Mcp Google Drive MCP server (@a1-x-tech/mcp-google-drive). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Mcp Google Drive, and thousands of servers like it.
This server
Across the catalogue