Open File by Link
access_file_by_urlWhen a user shares a Google Drive URL or asks you to access a specific file, use this tool. Accepts any Google Drive, Docs, Sheets or Slides URL and resolves it against the Google Drive API (https://developers.google.com/drive/api/reference/rest/v3). If the file is already accessible, returns its content. If not, returns a grant link the user can open to select it. If the user mentions the file's name, pass it as file_name_hint so the picker can search for it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | A Google Drive, Docs, Sheets, or Slides URL | |
| file_name_hint | No | The file's name if mentioned by the user. Extracted from conversation context. Used to pre-fill the file picker search. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| advice | No | what to tell the user when the file could not be returned — relay this rather than paraphrasing | |
| offset | No | where this slice of the text starts, when the file was read in chunks | |
| content | No | the file's text — this is what the tool exists to return, present whenever outcome is 'granted' | |
| file_id | No | ||
| outcome | Yes | which outcome this is: 'granted' (file resolved, details populated), 'too_large' (file exists but must be read in chunks — see size_chars), 'not_shared' (ShareWatch has no grant for it yet — give the user action_url), 'not_a_drive_link' (the URL points somewhere other than Google Drive — relay advice, there is no action_url and no grant can help), or 'unrecognized' (nothing in the input looked like a Drive link or ID). All of these are successes; a genuine failure arrives as an error. | |
| version | No | Drive's revision counter for the file at the time it was read | |
| file_name | No | ||
| mime_type | No | ||
| truncated | No | true when content is only part of the file — read the rest with read_file using offset | |
| action_url | No | the page the user opens to grant access to this specific file; give them this link | |
| size_chars | No | length of the file's text, when it was too large to return inline | |
| total_chars | No | total length of the file's text, which may exceed what content holds | |
| approx_tokens | No | rough token cost of the whole file, to help decide how to chunk it |