Search Google Docs
search_documentsFind Google Docs in the user's Drive by name or full-text content, returning accessible, non-trashed documents with IDs, URLs, and timestamps.
Instructions
Search the user’s Google Drive for Google Docs by name and/or content. Only Google Docs the user can access and that are not in the trash are returned (other file types are never included).
searchIn "name": case-insensitive match on the document name. Drive matches words that start with the query ("Prop" finds "FYP Proposal"), so a fragment from the middle of a word may not match. Results sorted by most recently modified.
searchIn "content": Google Drive full-text search of document content. It is word/prefix based (not exact substring or phrase matching), also matches document names, and may lag behind very recent edits because Drive indexes content asynchronously. Results are ordered by relevance.
searchIn "both" (default): name OR full-text match, ordered by relevance. Returns documentId, name, URL, createdTime and modifiedTime for each match, plus nextPageToken for pagination. To locate text inside one specific document use find_text; to list recent documents use list_documents.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of documents to return (1-100). | |
| query | Yes | Text to search for, e.g. "FYP" or "quarterly report". | |
| searchIn | No | Where to search: "name" (words in the document name starting with the query), "content" (Drive full-text index) or "both". | both |
| pageToken | No | nextPageToken from a previous search_documents call with the same query and searchIn, to get the next page. |