MCP ScannerCustom audit
All servers

taylorwilsdon/google_workspace_mcp

Control Gmail, Google Calendar, Docs, Sheets, Slides, Chat, Forms, Tasks, Search & Drive with AI - Comprehensive Google Workspace MCP Server & CLI Tool

Packageworkspace-mcp
Version2.6.0 in pyproject.toml
Publishertaylorwilsdon community
MCP Registrynot listed
Scanned2026-11-25
Scannerv1.3.0
Methodologyv1.2
Stars 3,522Forks 1,127Last push 2026-11-14
Python 100.0%by source files the scanner reads
Code safetypartly tracedExposure6.1Prompts10.0Supply chain7.0Secrets10.0Transparency10.0
Analysis confidence91%
How much of the server the scanner could read: tools analyzed, files parsed, limits hit.
Code Safetypartly traced—

Paths from tool input into commands, SQL, files and URLs

Capability Exposure6.1/10Fair

How much power the tools give an agent over the machine

Prompt Integritynothing published yet10.0/10

Hidden instructions and poisoning in text for the model

Supply Chain7.0/10Fair

Known vulnerabilities in the packages the server uses

Secrets & Credentialsnothing published yet10.0/10

How the server reads credentials and where they can go

Behavior Transparencynothing published yet10.0/10

Whether the tools do only what their descriptions say

How far the analysis went

The scanner traces each tool from its input to the operations its code performs, and here it could not follow every path. Code Safety is shown as partly traced instead of a score: no finding there is not a clean result. The score of Capability Exposure counts only what it could follow.

  • Some paths pass through more than 8 functions one inside another; the scanner stops there
  • In 1,849 places a tool's input is handed to a function whose name matches several definitions in the code; the scanner could not tell which one runs, so it stopped there
  • 15 of 143 tools, prompts and resources could not be followed through the code
  • 28 tools, prompts and resources registered only in the repository's tests are not counted on this page

Top risks in plain words

  • INFONo published risk: no tool declared to run commands, files, addresses or queries of the caller's choice, no known vulnerability in a production package, no advisory. Not every path through the code could be followed. Code findings appear here only after a person has verified them.

How to use it safely

Practical steps from what we found in this server. They lower the risk; they do not replace a review of the code.

  • Give it a narrowly scoped token

    Its code reads credentials or environment variables. Use a key limited to what this server needs, not your main one.

  • Keep confirmations on

    Leave your MCP client's confirmation prompt on for tools that change files, run commands or send data.

What its tools can do on your machine

The server offers 115 tools. When an AI agent calls them, this is what their code can do on the machine where the server runs, as traced in the source. Tools that call code the scanner could not follow may do more.

Read or write filesopen, create, change or delete files
create_drive_file, draft_gmail_message, get_doc_content, get_drive_file_download_url, import_to_google_doc, import_to_google_sheets and 5 more
11 of 115
Connect to the internet or other hostssend requests or open connections
batch_modify_gmail_message_labels, draft_gmail_message, get_gmail_message_content, get_gmail_messages_content_batch, get_gmail_thread_content, get_gmail_threads_content_batch and 8 more
14 of 115
Read passwords, tokens or keysload secrets such as API keys
create_drive_file, draft_gmail_message, get_search_engine_info, import_to_google_doc, import_to_google_sheets, import_to_google_slides and 4 more
10 of 115
Read environment variablesoften where API keys are kept
create_drive_file, draft_gmail_message, get_search_engine_info, import_to_google_doc, import_to_google_sheets, import_to_google_slides and 4 more
10 of 115
Touch sensitive locationssuch as ~/.ssh, cloud credentials or browser data
create_drive_file, draft_gmail_message, get_search_engine_info, import_to_google_doc, import_to_google_sheets, import_to_google_slides and 4 more
10 of 115

No tool was seen to: start other programs on the machine.

Where its requests and secrets go

Read from the names along each tool's calls, not from a run: what the code says, not every address it may reach at run time.

Hosts written in the code

The literal addresses the tools' requests name.

  • None: no request names a fixed host.
Addresses from settings

Constants or settings that start an address; the value comes from configuration.

  • None seen.
Secrets it reads

Credential-like environment variables. Give the server a key with the least access it needs.

  • GOOGLE_MCP_CREDENTIALS_DIR · draft_gmail_message, send_gmail_message
  • WORKSPACE_MCP_CREDENTIALS_DIR · draft_gmail_message, send_gmail_message

Text it brings in from outside

Text that reaches the model from outside: an instruction hidden in it can steer the agent (prompt injection). Treat what these tools return as data, not as orders.

  • files11 tools · create_drive_file, draft_gmail_message, get_doc_content +8

Tool annotations

112 of 115 tools declare annotations. readOnlyHint 51, destructiveHint 37, idempotentHint 51, openWorldHint 111.

Tools, prompts and resources (115: 115 tools)

Open a row for its full description. Chips show what its code can reach, and which risky capability its own description declares.

append_table_rowstool Appends rows to a structured table in a Google Sheet. The rows are added
Appends rows to a structured table in a Google Sheet. The rows are added
    to the end of the table body, automatically extending the table range.

    Use list_sheet_tables first to find the table ID.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        table_id (str): The ID of the table to append to (get from list_sheet_tables). Required.
        values (Union[str, List[List]]): 2D array of values to append. Each inner
            list is one row. Can be a JSON string or Python list. Required.

    Returns:
        str: Confirmation message with the number of rows appended.
batch_modify_gmail_message_labelstool Adds or removes labels on many Gmail messages, or on every message of wholeNetworkdestructive (declared)
Adds or removes labels on many Gmail messages, or on every message of whole
    conversations via thread_ids.

    message_ids are sent in one users.messages.batchModify call (Gmail accepts
    up to 1000 ids per call). That endpoint returns no per-message result and
    silently ignores ids it does not recognise, so by default the messages are
    read back afterwards to report which ids actually changed.

    thread_ids are modified one at a time with users.threads.modify, e.g.
    archive a conversation with remove_label_ids=["INBOX"] or mark it read with
    remove_label_ids=["UNREAD"]. Each thread reports its own outcome.
    message_ids and thread_ids can be combined; at least one is required, as is
    at least one of add_label_ids or remove_label_ids.

    Args:
        user_google_email (str): The user's Google email address. Required.
        message_ids (Optional[List[str]]): Message IDs to modify.
        add_label_ids (Optional[List[str]]): Label IDs to add.
        remove_label_ids (Optional[List[str]]): Label IDs to remove.
        verify (bool): Read message_ids back and report per-id outcomes, at the
            cost of one extra read per id (batched 25 at a time). Set False for
            very large sweeps where an unverified result is acceptable. Has no
            effect on thread_ids, which always report per thread.
        thread_ids (Optional[List[str]]): Thread (conversation) IDs to modify.

    Returns:
        str: Per-id outcomes for message_ids (applied, unchanged, not found, or
            unverified) and per-thread outcomes for thread_ids.
batch_update_doctool Executes multiple low-level document operations in a single atomic batch update.destructive (declared)
Executes multiple low-level document operations in a single atomic batch update.

    For normal header/footer text, prefer update_doc_headers_footers.
    Only use create_header_footer here for advanced section-break layouts.

    RECOMMENDED WORKFLOW FOR BUILDING DOCUMENTS:
    =============================================
    To avoid index calculation errors, build documents in phases:

    PHASE 1 - INSERT ALL CONTENT (use end_of_segment=true, no index math):
      Append text, section breaks, and page breaks sequentially.
      Each operation appends to the end of the body. No index needed.
      Example batch: [
        {"type": "insert_text", "end_of_segment": true, "text": "Report Title\\n"},
        {"type": "insert_text", "end_of_segment": true, "text": "\\nExecutive Summary\\n"},
        {"type": "insert_text", "end_of_segment": true, "text": "Revenue grew 15%.\\n"},
        {"type": "insert_section_break", "end_of_segment": true, "section_type": "NEXT_PAGE"},
        {"type": "insert_text", "end_of_segment": true, "text": "Detailed Analysis\\n"}
      ]

    PHASE 2 - CREATE HEADERS/FOOTERS (if needed):
      For normal header/footer text, use update_doc_headers_footers
      (it auto-creates if missing and writes the content for you).
      Only include create_header_footer operations in a batch when you are
      intentionally managing advanced section-break-specific layouts.

    PHASE 3 - INSPECT STRUCTURE:
      Call inspect_doc_structure with detailed=true to get exact start_index
      and end_index for every paragraph and element.

    PHASE 4 - APPLY FORMATTING (separate batch using indices from Phase 3):
      Use the real indices from inspect_doc_structure output: [
        {"type": "update_paragraph_style", "start_index": 1, "end_index": 15,
         "heading_level": 1, "alignment": "CENTER"},
        {"type": "format_text", "start_index": 1, "end_index": 15,
         "bold": true, "font_size": 24},
        {"type": "create_bullet_list", "start_index": 50, "end_index": 120,
         "list_type": "ORDERED"}
      ]

    ALTERNATIVE - FIND_REPLACE PATTERN (no indices needed at all):
      Insert text with unique placeholders, then use find_replace:
      [
        {"type": "insert_text", "end_of_segment": true, "text": "{{TITLE}}\\n{{BODY}}\\n"},
        {"type": "find_replace", "find_text": "{{TITLE}}", "replace_text": "Quarterly Report"},
        {"type": "find_replace", "find_text": "{{BODY}}", "replace_text": "The results show..."}
      ]

    ALTERNATIVE - SEMANTIC ANCHORS (target existing structure without indices):
      Insertion operations accept after_heading, before_heading, or anchor_text with
      anchor_position instead of index. Each is resolved against the document at
      execution time, so it cannot go stale the way a pre-computed index can, and
      an anchor matching zero or several places is refused rather than guessed.
      Submit anchored insertions in their own batch; they execute from highest
      index to lowest to keep targets stable. [
        {"type": "insert_text", "after_heading": "Results",
         "text": "Revenue grew 15%.\\n"},
        {"type": "insert_text", "anchor_text": "Conclusion",
         "anchor_position": "before", "text": "See appendix.\\n"}
      ]

    WARNING - AVOID THIS ANTI-PATTERN:
      Do NOT pre-compute sequential indices for multiple insert_text operations.
      Each insertion shifts all subsequent indices and manual calculation is error-prone.
      Use end_of_segment=true instead, which always appends to the current end.
      BAD:  [{"type":"insert_text","index":1,"text":"Hello\\n"},
             {"type":"insert_text","index":8,"text":"World\\n"}]  <- index 8 may be wrong
      GOOD: [{"type":"insert_text","end_of_segment":true,"text":"Hello\\n"},
             {"type":"insert_text","end_of_segment":true,"text":"World\\n"}]

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        operations: List of operation dicts. Each operation MUST have a 'type' field.
                    All operations accept an optional 'tab_id' to target a specific tab.

    Supported operation types and their parameters:

      insert_text      - required: text (str)
                         PREFERRED: end_of_segment (bool) - set true to append at end
                           of body without calculating an index. Safest way to build
                           documents sequentially.
                         optional: index (int), tab_id, segment_id
      delete_text      - required: start_index (int), end_index (int)
                         optional: tab_id, segment_id
      replace_text     - required: start_index (int), end_index (int), text (str)
                         optional: tab_id, segment_id
      format_text      - required: start_index (int), end_index (int)
                         optional: bold, italic, underline, strikethrough, font_size,
                                   font_family, font_weight, text_color, background_color,
                                   link_url, clear_link, baseline_offset, small_caps,
                                   tab_id, segment_id
      update_paragraph_style
                       - required: start_index (int), end_index (int)
                         optional: heading_level (0-6, 0=normal), alignment
                                   (START/CENTER/END/JUSTIFIED), line_spacing,
                                   indent_first_line, indent_start, indent_end,
                                   space_above, space_below, named_style_type,
                                   direction, keep_lines_together, keep_with_next,
                                   avoid_widow_and_orphan, page_break_before,
                                   spacing_mode, shading_color, border_edges,
                                   border_color, border_width, border_padding,
                                   border_dash, tab_id, segment_id
      update_table_cell_style
                       - required: table_start_index (int)
                         optional: background_color, border_color, border_width,
                                   padding_top, padding_bottom, padding_left,
                                   padding_right (float, points),
                                   content_alignment ("TOP"|"MIDDLE"|"BOTTOM"),
                                   row_index, column_index, row_span, column_span,
                                   border_edges ("top"|"bottom"|"left"|"right")
                         Use inspect_doc_structure to find table_start_index from
                         table_details[].start_index. If row/column values are
                         omitted, the style is applied to the entire table.
      insert_table     - required: rows (int), columns (int)
                         optional: index (int), tab_id, segment_id, end_of_segment
      insert_table_row - required: table_start_index (int), row_index (int)
                         optional: insert_below (bool, default true), tab_id
      delete_table_row - required: table_start_index (int), row_index (int)
                         optional: tab_id
      insert_table_column
                       - required: table_start_index (int), column_index (int)
                         optional: insert_right (bool, default true), tab_id
      delete_table_column
                       - required: table_start_index (int), column_index (int)
                         optional: tab_id
      merge_table_cells
                       - required: table_start_index (int), row_index (int),
                                   column_index (int), row_span (int), column_span (int)
                         optional: tab_id
      unmerge_table_cells
                       - required: table_start_index (int), row_index (int),
                                   column_index (int), row_span (int), column_span (int)
                         optional: tab_id
      update_table_column_properties
                       - required: table_start_index (int), column_indices (list[int])
                         optional: width (float, points), width_type
                                   (FIXED_WIDTH|EVENLY_DISTRIBUTED), tab_id
      update_table_row_style
                       - required: table_start_index (int), row_indices (list[int])
                         optional: min_row_height (float, points), tab_id
      pin_table_header_rows
                       - required: table_start_index (int),
                                   pinned_header_rows_count (int)
                         optional: tab_id
                         Set pinned_header_rows_count=1 to repeat the first row as
                         a header across page breaks (0 unpins all rows). This is
                         the writable request for the tableHeader state reported
                         in TableRowStyle.
      insert_page_break- optional: index (int), end_of_segment, tab_id
      insert_person    - required: email (str)
                         optional: index (int), end_of_segment, tab_id, segment_id
                         Inserts an @mention person smart chip.
      insert_date      - required: date (str, YYYY-MM-DD or ISO 8601 with a time zone)
                         optional: index (int), end_of_segment, tab_id, segment_id,
                         date_format, time_format, timezone
                         Inserts a date smart chip.
      insert_section_break
                       - optional: index (int), end_of_segment, section_type
                                   ('CONTINUOUS'|'NEXT_PAGE')
      find_replace     - required: find_text (str), replace_text (str)
                         optional: match_case (bool, default false)
      create_bullet_list - required: start_index (int), end_index (int)
                         optional: list_type ('UNORDERED'|'ORDERED'|'CHECKBOX'|'NONE',
                                   default UNORDERED), nesting_level (0-8),
                                   paragraph_start_indices (list[int]), bullet_preset
                         Use list_type='NONE' to remove existing bullet/list formatting
      create_named_range
                       - required: name (str), start_index (int), end_index (int)
                         optional: tab_id, segment_id
      replace_named_range_content
                       - required: text (str)
                         optional: named_range_id, named_range_name, tab_id
      delete_named_range
                       - optional: named_range_id, named_range_name, tab_id
      update_document_style
                       - optional: background_color, margin_top, margin_bottom,
                                   margin_left, margin_right, margin_header,
                                   margin_footer, page_width, page_height,
                                   page_number_start, use_even_page_header_footer,
                                   use_first_page_header_footer,
                                   flip_page_orientation, document_mode, tab_id
      update_section_style
                       - required: start_index (int), end_index (int)
                         optional: margin_top, margin_bottom, margin_left,
                                   margin_right, margin_header, margin_footer,
                                   page_number_start, use_first_page_header_footer,
                                   flip_page_orientation, content_direction,
                                   column_count, column_spacing,
                                   column_separator_style
      create_header_footer
                       - required: section_type ('header'|'footer')
                         optional: header_footer_type, section_break_index
                         Advanced only. For ordinary header/footer text, use
                         update_doc_headers_footers instead.
      insert_image     - required: image_uri (str)
                         optional: index, width, height, tab_id, segment_id,
                                   end_of_segment
      insert_doc_tab   - required: title (str), index (int)
                         optional: parent_tab_id (str)
      delete_doc_tab   - required: tab_id (str)
      update_doc_tab   - required: tab_id (str), title (str)

    Example - Safe document building (no index calculation needed):
        [
            {"type": "insert_text", "end_of_segment": true, "text": "Quarterly Report\\n\\n"},
            {"type": "insert_text", "end_of_segment": true, "text": "Executive Summary\\n"},
            {"type": "insert_text", "end_of_segment": true, "text": "Revenue grew 15% YoY.\\n"}
        ]

    Example - Formatting (use exact indices from inspect_doc_structure output):
        [
            {"type": "format_text", "start_index": 1, "end_index": 19, "bold": true, "font_size": 24},
            {"type": "update_paragraph_style", "start_index": 1, "end_index": 19,
             "heading_level": 1, "alignment": "CENTER"},
            {"type": "update_paragraph_style", "start_index": 20, "end_index": 39, "heading_level": 2}
        ]

    Example - Using find_replace (zero index risk):
        [
            {"type": "find_replace", "find_text": "{{DATE}}", "replace_text": "March 2026"},
            {"type": "find_replace", "find_text": "{{AUTHOR}}", "replace_text": "Jane Smith"}
        ]

    Example - Insert table at end of document:
        [{"type": "insert_table", "end_of_segment": true, "rows": 3, "columns": 4}]

    Example - Headers, footers, and document style:
        [
            {"type": "create_header_footer", "section_type": "header"},
            {"type": "create_header_footer", "section_type": "footer"},
            {"type": "update_document_style", "margin_top": 72, "margin_bottom": 72}
        ]

    Returns:
        str: Confirmation message with batch results and document length for chaining
batch_update_formtool Apply batch updates to a Google Form.destructive (declared)
Apply batch updates to a Google Form.

    Supports adding, updating, and deleting form items, as well as updating
    form metadata and settings. This is the primary method for modifying form
    content after creation.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form to update.
        requests (List[Dict[str, Any]]): List of update requests to apply.
            Supported request types:
            - createItem: Add a new question or content item
            - updateItem: Modify an existing item
            - deleteItem: Remove an item
            - moveItem: Reorder an item
            - updateFormInfo: Update form title/description
            - updateSettings: Modify form settings (e.g., quiz mode)

    Returns:
        str: Details about the batch update operation results.
batch_update_presentationtool Apply batch updates to a Google Slides presentation.destructive (declared)
Apply batch updates to a Google Slides presentation.

    Important:
        Each request object must contain exactly one supported Slides request
        type, such as createSlide, createShape, insertText, updateTextStyle,
        createImage, or deleteObject.

        insertText.objectId must be a text-capable shape or table object ID,
        not a slide/page object ID. To add text to a slide, create a text box
        or shape first with createShape, set elementProperties.pageObjectId to
        the slide ID, and then insertText into that shape objectId. To edit
        existing text, call get_presentation with action="page" and use a
        Shape or Table element ID.

        To write speaker (presenter) notes, call get_presentation with
        action="page" to get the slide's speaker notes shape ID, then target
        that ID: deleteText with textRange {"type": "ALL"} to clear
        the existing notes (omit this when they are already empty, which errors),
        followed by insertText at insertionIndex 0. The notes page ID is not a
        valid target.

    Args:
        user_google_email (str): The user's Google email address. Required.
        presentation_id (str): The ID of the presentation to update.
        requests (List[Dict[str, Any]]): List of update requests to apply.

    Returns:
        str: Details about the batch update operation results.
check_drive_file_public_accesstool Searches for a file by name and checks if it has public link sharing enabled.read-only (declared)
Searches for a file by name and checks if it has public link sharing enabled.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name of the file to check.
        drive_id (Optional[str]): ID of the shared drive to scope the search to. When set, the
                                  underlying files.list call uses corpora='drive' and the given
                                  driveId, which is required to reliably find files that live only
                                  in that shared drive. When None, behaviour is unchanged
                                  (default API corpora applies).

    Returns:
        str: Information about the file's sharing status and whether it can be used in Google Docs.
copy_drive_filetool Creates a copy of an existing Google Drive file.
Creates a copy of an existing Google Drive file.

    This tool copies the template document to a new location with an optional new name.
    The copy maintains all formatting and content from the original file.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file to copy. Required.
        new_name (Optional[str]): New name for the copied file. If not provided, uses "Copy of [original name]".
        parent_folder_id (str): The ID of the folder where the copy should be created. Defaults to 'root' (My Drive).
        copy_comments (bool): Copy open comments and suggestions (Docs/Sheets/Slides only). Defaults to False.

    Returns:
        str: Confirmation message with details of the copied file and its link.
create_doctool Creates a new Google Doc and optionally inserts initial content.
Creates a new Google Doc and optionally inserts initial content.

    `content` is inserted as plain text (Markdown is not rendered); use
    import_to_google_doc to create a doc from Markdown.

    After creation, the document body starts at index 1. A new empty doc
    has total length 2 (one section break at index 0, one newline at index 1).

    To build a rich document after creation, use batch_update_doc with
    insert_text operations using end_of_segment=true to append content
    sequentially without calculating indices. Then call inspect_doc_structure
    to get exact positions before applying formatting in a separate batch call.

    Args:
        user_google_email: User's Google email address
        title: Title of the new document
        content: Optional initial plain text content to insert
        folder_id: The ID of the parent folder. Defaults to 'root'. For shared
            drives, this must be a folder ID within the shared drive.

    Returns:
        str: Confirmation message with document ID, link, and initial document state.
create_drive_filetool Creates a new file in Google Drive, supporting creation within shared drives.FilesCredentialsEnv varsSensitive pathsoutside text
Creates a new file in Google Drive, supporting creation within shared drives.
    Accepts direct text content, inline base64 bytes, or a fileUrl to fetch content from.
    Where local file access is disabled it can instead return an upload URL for the
    caller to PUT file bytes to. With shortcut_target_id it creates a Drive shortcut
    to an existing file or folder instead.
    This stores the supplied bytes without converting them to Google Docs, Sheets, or
    Slides. Use the matching import_to_google_* tool for Google-native conversion.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new file.
        content (Optional[str]): If provided, the content to write to the file.
        folder_id (str): The ID of the parent folder. Defaults to 'root'. For shared drives, this must be a folder ID within the shared drive.
        mime_type (Optional[str]): The MIME type of the file. Defaults to 'text/plain'; required with return_upload_url.
        fileUrl (Optional[str]): If provided, fetches the file content from this URL. Supports http:// and https://; file:// only where local file access is enabled. Where it is disabled, files on the caller's machine go through an upload URL instead (see the upload-URL parameter, if offered).
        base64_content (Optional[str]): Standard base64-encoded file bytes.
        content_mime_type (Optional[str]): MIME type for base64_content uploads.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL for a new file of mime_type instead of creating it from inline content; the caller PUTs the bytes there directly (no Authorization header). Preferred for large or binary files. Not combinable with other content sources. Offered only where local file access is disabled.
        shortcut_target_id (Optional[str]): ID of an existing file or folder. Creates a shortcut named file_name in folder_id that points to it, so the item shows up in a second folder without being copied. Not combinable with content sources; mime_type may be omitted.

    Returns:
        str: Confirmation message of the successful file creation with file link,
            or the resumable upload URL.
create_drive_foldertool Creates a new folder in Google Drive, supporting creation within shared drives.
Creates a new folder in Google Drive, supporting creation within shared drives.

    Args:
        user_google_email (str): The user's Google email address. Required.
        folder_name (str): The name for the new folder.
        parent_folder_id (str): The ID of the parent folder. Defaults to 'root'.
            For shared drives, use a folder ID within that shared drive.

    Returns:
        str: Confirmation message with folder name, ID, and link.
create_formtool Create a new form using the title given in the provided form message in the request.
Create a new form using the title given in the provided form message in the request.

    Args:
        user_google_email (str): The user's Google email address. Required.
        title (str): The title of the form.
        description (Optional[str]): The description of the form.
        document_title (Optional[str]): The document title (shown in browser tab).

    Returns:
        str: Confirmation message with form ID and edit URL.
create_presentationtool Create a new Google Slides presentation and return its ID and URL.
Create a new Google Slides presentation and return its ID and URL.

    Args:
        user_google_email (str): The user's Google email address. Required.
        title (str): The title for the new presentation. Defaults to "Untitled Presentation".

    Returns:
        str: Details about the created presentation including ID and URL.
create_reactiontool Adds an emoji reaction to a Google Chat message.
Adds an emoji reaction to a Google Chat message.

    Args:
        message_id: The message resource name (e.g. spaces/X/messages/Y).
        emoji_unicode: The emoji character to react with (e.g. 👍).

    Returns:
        str: Confirmation message.
create_sheettool Creates a new sheet or duplicates an existing sheet, into destination_spreadsheet_id when given (user_google_email: str, spreadsheet_id: str, sheet_name: Option
Creates a new sheet or duplicates an existing sheet, into destination_spreadsheet_id when given (user_google_email: str, spreadsheet_id: str, sheet_name: Optional[str] = None, source_sheet_name: Optional[str] = None, insert_sheet_index: Optional[int] = None, destination_spreadsheet_id: Optional[str] = None).
create_spreadsheettool Creates a new Google Spreadsheet.
Creates a new Google Spreadsheet.

    Args:
        user_google_email (str): The user's Google email address. Required.
        title (str): The title of the new spreadsheet. Required.
        sheet_names (Optional[List[str]]): List of sheet names to create. If not provided, creates one sheet with default name.
        folder_id (str): The ID of the parent folder. Defaults to 'root'. For shared
            drives, this must be a folder ID within the shared drive.

    Returns:
        str: Information about the newly created spreadsheet including ID, URL, and locale.
create_table_with_datatool Creates a table and populates it with data in one reliable operation.
Creates a table and populates it with data in one reliable operation.

    CRITICAL: YOU MUST CALL inspect_doc_structure FIRST TO GET THE INDEX!

    MANDATORY WORKFLOW - DO THESE STEPS IN ORDER:

    Step 1: ALWAYS call inspect_doc_structure first
    Step 2: Use the 'total_length' value from inspect_doc_structure as your index
    Step 3: Format data as 2D list: [["col1", "col2"], ["row1col1", "row1col2"]]
    Step 4: Call this function with the correct index and data

    EXAMPLE DATA FORMAT:
    table_data = [
        ["Header1", "Header2", "Header3"],    # Row 0 - headers
        ["Data1", "Data2", "Data3"],          # Row 1 - first data row
        ["Data4", "Data5", "Data6"]           # Row 2 - second data row
    ]

    CRITICAL INDEX REQUIREMENTS:
    - NEVER use index values like 1, 2, 10 without calling inspect_doc_structure first
    - ALWAYS get index from inspect_doc_structure 'total_length' field
    - Index must be a valid insertion point in the document

    DATA FORMAT REQUIREMENTS:
    - Must be 2D list of strings only
    - Each inner list = one table row
    - All rows MUST have same number of columns
    - Use empty strings "" for empty cells, never None
    - Use debug_table_structure after creation to verify results

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        table_data: 2D list of strings - EXACT format: [["col1", "col2"], ["row1col1", "row1col2"]]
        index: Document position (MANDATORY: get from inspect_doc_structure 'total_length')
        bold_headers: Whether to make first row bold (default: true)
        tab_id: Optional tab ID to create the table in a specific tab
        header_rows: Number of leading rows to mark as a repeating header that
            reappears after each page break. Must be between 0 and the number of
            table rows (default: 0 = none)

    Returns:
        str: Confirmation with table details and link
debug_table_structuretool ESSENTIAL DEBUGGING TOOL - Use this whenever tables don't work as expected.read-only (declared)
ESSENTIAL DEBUGGING TOOL - Use this whenever tables don't work as expected.

    USE THIS IMMEDIATELY WHEN:
    - Table population put data in wrong cells
    - You get "table not found" errors
    - Data appears concatenated in first cell
    - Need to understand existing table structure
    - Planning to fill existing cells with modify_doc_text at their insertion_index

    WHAT THIS SHOWS YOU:
    - Exact table dimensions (rows × columns)
    - Each cell's position coordinates (row,col)
    - Current content in each cell
    - Insertion indices for each cell
    - Table boundaries and ranges

    HOW TO READ THE OUTPUT:
    - "dimensions": "2x3" = 2 rows, 3 columns
    - "position": "(0,0)" = first row, first column
    - "current_content": What's actually in each cell right now
    - "insertion_index": Where new text would be inserted in that cell

    WORKFLOW INTEGRATION:
    1. After creating table → Use this to verify structure
    2. Before populating → Use this to plan your data format
    3. After population fails → Use this to see what went wrong
    4. When debugging → Compare your data array to actual table structure

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to inspect
        table_index: Which table to debug (0 = first table, 1 = second table, etc.)
        tab_id: Optional ID of the tab containing the table (from inspect_doc_structure).
            If not provided, inspects the first tab.

    Returns:
        str: Detailed JSON structure showing table layout, cell positions, and current content
download_chat_attachmenttool Downloads an attachment from a Google Chat message and saves it to local disk.
Downloads an attachment from a Google Chat message and saves it to local disk.

    In stdio mode, returns the local file path for direct access.
    In HTTP mode, returns a temporary download URL (valid for 1 hour).

    Args:
        message_id: The message resource name (e.g. spaces/X/messages/Y).
        attachment_index: Zero-based index of the attachment to download (default 0).

    Returns:
        str: Attachment metadata with either a local file path or download URL.
draft_gmail_messagetool Creates a draft email in the user's Gmail account. Supports new, reply, and forwardFilesNetworkCredentialsEnv varsSensitive pathsoutside text
Creates a draft email in the user's Gmail account. Supports new, reply, and forward
    drafts with optional attachments. Supports Gmail's "Send As" feature to draft from
    configured alias addresses.

    To save a forward as a draft for review, pass forward_message_id. The original
    subject, body (quoted with a "Forwarded message" header), and attachments are
    carried over. In forward mode, body (if any) is prepended as a note, subject is
    optional, and threading, reply, and signature options do not apply.

    SCHEDULED SEND IS NOT AVAILABLE. Gmail's REST API exposes no send-time
    parameter; the Schedule send feature is web-UI only, and a message cannot be
    placed in the Scheduled folder through the API. Do not claim a message was
    scheduled. To deliver at a chosen time, create a draft with
    draft_gmail_message. An external scheduler must retain the message data to
    create and send a new message via send_gmail_message then, or call
    users.drafts.send with the draft ID returned by draft_gmail_message.
    Alternatively, let the user schedule the draft in the Gmail UI.

    Args:
        user_google_email (str): The user's Google email address. Required for authentication.
        subject (Optional[str]): Email subject. Required for a new draft. Optional when
            replying with thread_id (inherits the parent message's subject) or forwarding
            (then defaults to 'Fwd: <original subject>').
        body (Optional[str]): Email body. Required unless forwarding (then an optional prepended note).
        body_format (Literal['plain', 'html']): Email body format. Defaults to 'plain'.
        forward_message_id (Optional[str]): Gmail message ID to forward. When set, the draft is a forward of that message.
        include_forwarded_attachments (bool): Whether to carry over the original attachments when forwarding. Defaults to True.
        to (Optional[str]): Optional recipient email address. Can be left empty for drafts.
        cc (Optional[str]): Optional CC email address.
        bcc (Optional[str]): Optional BCC email address.
        from_name (Optional[str]): Optional sender display name. If provided, the From header will be formatted as 'Name <email>'.
        from_email (Optional[str]): Optional 'Send As' alias email address. The alias must be
            configured in Gmail settings (Settings > Accounts > Send mail as). If not provided,
            the draft uses the account's default Send As address, then the primary or first
            usable Send-As entry, falling back to the authenticated user's email when Gmail
            returns no usable entry or settings access is not authorized.
        thread_id (Optional[str]): Optional Gmail thread ID to reply within. When
            in_reply_to is omitted, replies to the latest non-draft, non-trash message
            with an RFC Message-ID.
        in_reply_to (Optional[str]): Optional RFC Message-ID to explicitly reply to
            a specific message. Omit to reply to the latest eligible message.
        references (Optional[str]): Optional RFC Message-ID ancestry chain. Normally
            omit when thread_id is provided; the chain is derived automatically.
        attachments (List[Dict[str, str]]): Optional list of attachments. Each dict can contain:
            Option 1 - File path (auto-encodes):
              - 'path' (required): File path to attach
              - 'filename' (optional): Override filename
              - 'mime_type' (optional): Override MIME type (auto-detected if not provided)
            Option 2 - Base64 content:
              - 'content' (required): Standard base64-encoded file content (not urlsafe)
              - 'filename' (required): Name of the file
              - 'mime_type' (optional): MIME type (defaults to 'application/octet-stream')
        include_signature (bool): Whether to append Gmail signature HTML from send-as settings.
            When include_signature is true and Gmail signature retrieval fails for benign reasons
            (e.g., missing settings authorization), the draft proceeds with the requested or
            authenticated sender and without a signature.
            Non-benign failures such as quota/rate-limit or API errors raise ToolError and abort
            the draft.
        quote_original (bool): Whether to include the original message as a quoted reply.
            Only has an effect when thread_id is provided. When enabled, fetches the
            original message and appends it below the signature. Defaults to False.
        reply_all (bool): Whether to derive reply-all recipients from the thread: To = the
            sender being replied to, Cc = the other participants, excluding the authenticated
            account and from_email. Requires thread_id. Explicit to/cc win over the derived
            values; when cc is omitted, the sender being replied to is added to the derived Cc
            unless they are already in To.
        priority (str): 'high' or 'low' adds priority headers. Defaults to 'normal'.

    Returns:
        str: Confirmation message with the created draft's ID.

    Examples:
        # Create a new draft
        draft_gmail_message(subject="Hello", body="Hi there!", to="[email protected]")

        # Create a draft from a configured alias (Send As)
        draft_gmail_message(
            subject="Business Inquiry",
            body="Hello from my business address...",
            to="[email protected]",
            from_email="[email protected]"
        )

        # Create a plaintext draft with CC and BCC
        draft_gmail_message(
            subject="Project Update",
            body="Here's the latest update...",
            to="[email protected]",
            cc="[email protected]",
            bcc="[email protected]"
        )

        # Create a HTML draft with CC and BCC
        draft_gmail_message(
            subject="Project Update",
            body="<strong>Hi there!</strong>",
            body_format="html",
            to="[email protected]",
            cc="[email protected]",
            bcc="[email protected]"
        )

        # Create a reply draft in plaintext
        draft_gmail_message(
            subject="Re: Meeting tomorrow",
            body="Thanks for the update!",
            to="[email protected]",
            thread_id="thread_123"
        )

        # Create a reply draft in HTML
        draft_gmail_message(
            subject="Re: Meeting tomorrow",
            body="<strong>Thanks for the update!</strong>",
            body_format="html",
            to="[email protected]",
            thread_id="thread_123"
        )

        # Save a forward (with the original attachments) as a draft for review
        draft_gmail_message(
            to="[email protected]",
            forward_message_id="abc123",
            body="FYI - see below."
        )
export_doc_to_pdftool Exports a Google Doc to PDF format and saves it to Google Drive.
Exports a Google Doc to PDF format and saves it to Google Drive.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the Google Doc to export
        pdf_filename: Name for the PDF file (optional - if not provided, uses original name + "_PDF")
        folder_id: Drive folder ID to save PDF in (optional - if not provided, saves in root)

    Returns:
        str: Confirmation message with PDF file details and links
find_and_replace_doctool Finds and replaces text throughout a Google Doc. No index calculation required.destructive (declared)
Finds and replaces text throughout a Google Doc. No index calculation required.

    This is the safest way to update specific text in a document because it
    does not require knowing any indices. Use this tool when you need to:
    - Replace placeholder text (e.g., {{TITLE}}) with real content
    - Update specific words or phrases throughout the document
    - Make targeted text changes without risk of index errors

    For building documents from scratch, consider inserting text with unique
    placeholders via batch_update_doc, then using this tool to replace them.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        find_text: Text to search for
        replace_text: Text to replace with
        match_case: Whether to match case exactly
        tab_id: Optional ID of the tab to target

    Returns:
        str: Confirmation message with replacement count
format_sheet_rangetool Applies formatting to a range: colors, number formats, text wrapping,destructive (declared)
Applies formatting to a range: colors, number formats, text wrapping,
    alignment, text styling, cell merging/unmerging, borders, and dropdown lists.

    Colors accept hex strings (#RRGGBB). Number formats follow Sheets types
    (e.g., NUMBER, CURRENCY, DATE, PERCENT). If no sheet name is provided,
    the first sheet is used.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        range_name (str): A1-style range (optionally with sheet name). Required.
        background_color (Optional[str]): Hex background color (e.g., "#FFEECC").
        text_color (Optional[str]): Hex text color (e.g., "#000000").
        number_format_type (Optional[str]): Sheets number format type (e.g., "DATE").
        number_format_pattern (Optional[str]): Custom pattern for the number format.
        wrap_strategy (Optional[str]): Text wrap strategy - WRAP (wrap text within
            cell), CLIP (clip text at cell boundary), or OVERFLOW_CELL (allow text
            to overflow into adjacent empty cells).
        horizontal_alignment (Optional[str]): Horizontal text alignment - LEFT,
            CENTER, or RIGHT.
        vertical_alignment (Optional[str]): Vertical text alignment - TOP, MIDDLE,
            or BOTTOM.
        bold (Optional[bool]): Whether to apply bold formatting.
        italic (Optional[bool]): Whether to apply italic formatting.
        font_size (Optional[int]): Font size in points.
        merge_cells (Optional[bool]): True merges the range, False unmerges it.
            Merging keeps only the top-left value of each merged group.
        merge_type (Optional[str]): MERGE_ALL (default), MERGE_COLUMNS, or
            MERGE_ROWS. Setting it implies merge_cells=True.
        borders (Optional[str]): Which borders to draw, comma-separated: all,
            outer, inner, top, bottom, left, right, inner_horizontal,
            inner_vertical (e.g., "outer" or "bottom,inner_horizontal").
            "none" removes every border in the range.
        border_style (Optional[str]): SOLID (default), SOLID_MEDIUM, SOLID_THICK,
            DASHED, DOTTED, or DOUBLE. Requires borders.
        border_color (Optional[str]): Hex border color (default black). Requires
            borders.
        dropdown_values (Optional[List[str]]): Turns every cell in the range into
            a dropdown offering these values (e.g., ["open", "done"]).
        dropdown_strict (Optional[bool]): With dropdown_values: reject other
            input (default True) or only show a warning (False).
        clear_dropdown (Optional[bool]): Remove all data validation from the
            range: dropdowns, but also checkboxes and other validation rules.

    Returns:
        str: Confirmation of the applied formatting.
functool
No description.
generate_trigger_codetool Generates Apps Script code for creating triggers.read-only (declared)
Generates Apps Script code for creating triggers.

    The Apps Script API cannot create triggers directly - they must be created
    from within Apps Script itself. This tool generates the code you need.
    To list or remove existing triggers without opening the editor, use
    `manage_script_trigger` (action="list" / action="delete") instead.

    Args:
        trigger_type: Type of trigger. One of:
                      - "time_minutes" (run every N minutes: 1, 5, 10, 15, 30)
                      - "time_hours" (run every N hours: 1, 2, 4, 6, 8, 12)
                      - "time_daily" (run daily at a specific hour: 0-23)
                      - "time_weekly" (run weekly on a specific day)
                      - "on_open" (simple trigger - runs when document opens)
                      - "on_edit" (simple trigger - runs when user edits)
                      - "on_form_submit" (runs when form is submitted)
                      - "on_change" (runs when content changes)

        function_name: The function to run when trigger fires (e.g., "sendDailyReport")

        schedule: Schedule details (depends on trigger_type):
                  - For time_minutes: "1", "5", "10", "15", or "30"
                  - For time_hours: "1", "2", "4", "6", "8", or "12"
                  - For time_daily: hour as "0"-"23" (e.g., "9" for 9am)
                  - For time_weekly: "MONDAY", "TUESDAY", etc.
                  - For simple triggers (on_open, on_edit): not needed

    Returns:
        str: Apps Script code to create the trigger
get_contacttool Get detailed information about a specific contact.read-only (declared)
Get detailed information about a specific contact.

    Args:
        user_google_email (str): The user's Google email address. Required.
        contact_id (str): The contact ID (e.g., "c1234567890" or full resource name "people/c1234567890").

    Returns:
        str: Detailed contact information.
get_contact_grouptool Get details of a specific contact group including its members.read-only (declared)
Get details of a specific contact group including its members.

    Args:
        user_google_email (str): The user's Google email address. Required.
        group_id (str): The contact group ID.
        max_members (int): Maximum number of members to return (default: 100, max: 1000).

    Returns:
        str: Contact group details including members.
get_doc_as_markdowntool Reads a Google Doc and returns it as clean Markdown with optional comment context.read-only (declared)
Reads a Google Doc and returns it as clean Markdown with optional comment context.

    Unlike get_doc_content which returns plain text, this tool preserves document
    formatting as Markdown: headings, bold/italic/strikethrough, links, code spans,
    ordered/unordered lists with nesting, and tables.

    When comments are included (the default), each comment's anchor text — the specific
    text the comment was attached to — is preserved, giving full context for the discussion.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the Google Doc (or full URL). When a full URL is provided
            and it contains a ?tab= query parameter, that tab is used automatically
            unless tab_id is also specified (explicit tab_id takes precedence).
        include_comments: Whether to include comments (default: True)
        comment_mode: How to display comments:
            - "inline": Footnote-style references placed at the anchor text location (default)
            - "appendix": All comments grouped at the bottom with blockquoted anchor text
            - "none": No comments included
        include_resolved: Whether to include resolved comments (default: False)
        suggestions_view_mode: How to render suggestions in the returned content:
            - "DEFAULT_FOR_CURRENT_ACCESS": Default based on user's access level
            - "SUGGESTIONS_INLINE": Suggested changes appear inline in the document
            - "PREVIEW_SUGGESTIONS_ACCEPTED": Preview as if all suggestions were accepted
            - "PREVIEW_WITHOUT_SUGGESTIONS": Preview as if all suggestions were rejected
        tab_id: Optional ID of a single tab to read (from inspect_doc_structure).
            When given, only that tab's content is rendered, without its child tabs
            and without a tab heading, and comments are listed as document-wide.
            When omitted, every tab is rendered. Pass "" to read every tab of a
            URL that carries ?tab=. This filters output only: the whole document
            is still fetched.
        include_colors: Follow text that has an explicit RGB foreground color
            with "[color: #rrggbb]" (default: False). Theme colors are not shown.
        heading: Text of a body heading (case-insensitive, must match exactly one)
            whose section to render instead of the whole document: the heading and
            everything below it up to the next heading of equal or shallower level.
            Comments are listed as document-wide. tab_id is required when the doc
            has multiple tabs.
        heading_level: Optional 1-6 heading level to narrow the heading match.

    Returns:
        str: The document content as Markdown, optionally with comments
get_doc_contenttool Retrieves content of a Google Doc or a Drive file (like .docx) identified by document_id.Filesoutside textread-only (declared)
Retrieves content of a Google Doc or a Drive file (like .docx) identified by document_id.
    - Native Google Docs: Fetches content via Docs API.
    - Office files (.docx, etc.) stored in Drive: Downloads via Drive API and extracts text.

    By default, native Google Docs text is index-aligned with the document:
    empty paragraphs are preserved and every non-text element that occupies an
    index (inline object, page break, footnote reference, ...) is rendered as one
    U+FFFC placeholder per index. The document body starts at index 1, so an
    offset n into the text that follows "--- CONTENT ---" is document index n + 1,
    and that index can be passed straight to format_text or delete_text. Tables
    and multi-tab documents interleave separators, so alignment holds up to the
    first table or tab header.

    Set preserve_context=True for readable link destinations, internal targets,
    smart-chip values, table boundaries, headers, footers, footnotes, and object
    context exposed by the Docs API. This output is plain text, not Markdown,
    and its offsets must not be used as document editing indices. Comments,
    revision history, exact visual layout, and chip details hidden by the API
    are not included. Use get_doc_as_markdown for formatting or comments.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the Google Doc or Drive file (or full URL). A Docs
            URL's ?tab= selects that tab unless tab_id is also specified.
        suggestions_view_mode: How to render suggestions in the returned content:
            - "DEFAULT_FOR_CURRENT_ACCESS": Default based on user's access level
            - "SUGGESTIONS_INLINE": Suggested changes appear inline in the document
            - "PREVIEW_SUGGESTIONS_ACCEPTED": Preview as if all suggestions were accepted
            - "PREVIEW_WITHOUT_SUGGESTIONS": Preview as if all suggestions were rejected
        tab_id: Optional ID of a single tab to read (from inspect_doc_structure).
            When given, only that tab's content is returned with no tab separator,
            so the default output stays index-aligned with that tab. When
            omitted, every tab is returned with "--- TAB: ... ---" markers.
            Pass "" to read every tab of a URL that carries ?tab=. This
            filters output only: the whole document is still fetched.
        preserve_context: Include readable semantic annotations for native Docs.
            Defaults to False to retain index alignment. Office extraction is
            unaffected. With tab_id, only the selected tab is rendered.
        heading: Text of a body heading (case-insensitive, must match exactly one)
            whose section to return instead of the whole document: the heading and
            everything below it up to the next heading of equal or shallower level.
            The header reports the section's start index s, and in the default
            output offset n is document index n + s. Native Google Docs only;
            tab_id is required when the doc has multiple tabs.
        heading_level: Optional 1-6 heading level to narrow the heading match.

    Returns:
        str: The document content with metadata header.
get_drive_file_contenttool Retrieves the content of a specific Google Drive file by ID, supporting files in shared drives.read-only (declared)
Retrieves the content of a specific Google Drive file by ID, supporting files in shared drives.

    • Native Google Docs, Sheets, Slides → exported as text / CSV.
    • Office files (.docx, .xlsx, .pptx) → unzipped & parsed with std-lib to
      extract readable text.
    • PDFs → text extracted with pypdf when possible; scanned/image-only PDFs
      fall back to a download hint.
    • Images (PNG, JPEG, GIF, WebP) → returned as MCP image content after the
      metadata header. SVG → returned as its markup; raster images it embeds
      as base64 are attached as image content, numbered to match their place
      in the markup. BMP and TIFF → base64 text, or a download hint when over
      the default page size.
    • Any other file → downloaded; tries UTF-8 decode, else notes binary.

    Args:
        user_google_email: The user’s Google email address.
        file_id: Drive file ID.
        offset: Character offset to read on from after a truncated result.
        full_content: Return all content from offset onward in one call
            instead of a page of the default size.

    Returns:
        str: The file content as plain text with a metadata header that carries
        the file's version, so a reader paging by offset can tell when it
        changed and restart from offset=0. For images, a ToolResult with that
        text followed by the image as image content.
get_drive_file_download_urltool Downloads a Google Drive file and saves it to local disk.Filesoutside textread-only (declared)
Downloads a Google Drive file and saves it to local disk.

    In stdio mode, returns the local file path for direct access.
    In HTTP mode, returns a temporary download URL (valid for 1 hour).
    In stateless mode (no file storage), returns the file itself as an embedded
    resource, up to WORKSPACE_MCP_STATELESS_INLINE_MAX_BYTES (default 10 MiB,
    and never more than WORKSPACE_MCP_MAX_FILE_BYTES when that is set).

    For Google native files (Docs, Sheets, Slides, Drawings), exports to a useful format:
    - Google Docs -> PDF (default) or DOCX if export_format='docx'
    - Google Sheets -> XLSX (default), PDF if export_format='pdf', or CSV if export_format='csv'
    - Google Slides -> PDF (default) or PPTX if export_format='pptx'
    - Google Drawings -> PNG (default), or PDF, JPG or SVG if export_format='pdf', 'jpg' or 'svg'

    For other files, downloads the original file format.

    Args:
        user_google_email: The user's Google email address. Required.
        file_id: The Google Drive file ID to download.
        export_format: Optional export format for Google native files.
                      Options: 'pdf', 'docx', 'xlsx', 'csv', 'pptx', 'png', 'jpg', 'svg'.
                      If not specified, uses sensible defaults (PDF for Docs/Slides, XLSX for Sheets,
                      PNG for Drawings).
                      For Sheets: supports 'csv', 'pdf', or 'xlsx' (default).

    Returns:
        str: File metadata with either a local file path or download URL. In
        stateless mode the same text comes back as a ToolResult that also
        embeds the file; the annotation stays str so the advertised output
        schema is unchanged.
get_drive_file_permissionstool Gets detailed metadata about a Google Drive file including sharing permissions,read-only (declared)
Gets detailed metadata about a Google Drive file including sharing permissions,
    parent folder IDs, ownership, and lifecycle timestamps.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file to check permissions for.

    Returns:
        str: Detailed file metadata including parents, owners, timestamps, sharing status, and URLs.
get_drive_shareable_linktool Gets the shareable link for a Google Drive file or folder.read-only (declared)
Gets the shareable link for a Google Drive file or folder.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file or folder to get the shareable link for. Required.

    Returns:
        str: The shareable links and current sharing status.
get_eventstool Retrieves events from a specified Google Calendar. Can retrieve a single event by ID or multiple events within a time range.read-only (declared)
Retrieves events from a specified Google Calendar. Can retrieve a single event by ID or multiple events within a time range.
    You can also search for events by keyword by supplying the optional "query" param.

    Args:
        user_google_email (str): The user's Google email address. Required.
        calendar_id (str): The ID of the calendar to query. Use 'primary' for the user's primary calendar. Defaults to 'primary'. Calendar IDs can be obtained using `list_calendars`.
        event_id (Optional[str]): The ID of a specific event to retrieve. If provided, retrieves only this event and ignores time filtering parameters.
        time_min (Optional[str]): The start of the time range (inclusive) in RFC3339 format (e.g., '2024-05-12T10:00:00Z' or '2024-05-12'). If omitted, defaults to the current time when single_events=True. It is omitted from unexpanded queries so recurring masters that began in the past but still have future occurrences remain discoverable. Ignored if event_id is provided.
        time_max (Optional[str]): The end of the time range (exclusive) in RFC3339 format. If omitted, events starting from `time_min` onwards are considered (up to `max_results`). Ignored if event_id is provided.
        max_results (int): The maximum number of events to return in one page. Defaults to 25. Ignored if event_id is provided.
        page_token (Optional[str]): Token for the next page, taken from a previous response. When single_events=True, also pass the response's Pagination time_min as time_min, even if omitted on the first call. Keep all other query parameters unchanged. Ignored if event_id is provided.
        query (Optional[str]): A keyword to search for within event fields (summary, description, location). Ignored if event_id is provided.
        detailed (bool): Whether to return detailed event information including description, location, colour (colorId), attendees, and attendee details (response status, organizer, optional flags). Recurring instances also report the parent series ID needed to edit the whole series; recurring masters report their raw RFC5545 recurrence rules; and events that are not ordinary confirmed meetings report their event type (outOfOffice, workingLocation, focusTime) and status. Custom reminders (an empty list means none), non-default visibility and transparency are reported too; events using the calendar's default reminders omit the Reminders line. Defaults to False.
        include_attachments (bool): Whether to include attachment information in detailed event output. When True, shows attachment details (fileId, fileUrl, mimeType, title) for events that have attachments. Only applies when detailed=True. Set this to True when you need to view or access files that have been attached to calendar events, such as meeting documents, presentations, or other shared files. Defaults to False.
        single_events (bool): Whether to expand recurring series into individual instances. Defaults to True for backwards compatibility. Set to False with detailed=True to retrieve recurring master events and their exact RFC5545 recurrence rules instead of inferring cadence from expanded instances.

    Returns:
        str: A formatted list of events (summary, start and end times, link) within the specified range, or detailed information for a single event if event_id is provided. When more events remain beyond max_results, a "Next page token" line is appended.
get_formtool Get a form.read-only (declared)
Get a form.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form to retrieve.

    Returns:
        str: Form details including title, description, questions, and URLs.
get_form_responsetool Get one response from the form.read-only (declared)
Get one response from the form.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form.
        response_id (str): The ID of the response to retrieve.

    Returns:
        str: Response details including answers and metadata.
get_gmail_attachment_contenttool Downloads an email attachment and saves it to local disk.
Downloads an email attachment and saves it to local disk.

    In stdio mode, returns the local file path for direct access.
    In HTTP mode, returns a temporary download URL (valid for 1 hour).
    May re-fetch message metadata to resolve filename and MIME type.

    Args:
        message_id (str): The ID of the Gmail message containing the attachment.
        attachment_id (str): The ID of the attachment to download.
        user_google_email (str): The user's Google email address. Required.
        return_base64 (bool): When True, includes the full attachment as a
            standard base64 string in the response (in addition to any file
            path or download URL). Useful for sandboxed clients that cannot
            reach localhost download URLs or the MCP server's local file
            paths (e.g. containerized agents with network allowlists). The
            returned base64 uses the standard alphabet, so it can be passed
            directly to tools like ``draft_gmail_message`` that expect
            standard (not URL-safe) base64. Default False preserves the
            existing behavior and response size.
        attachment_index (Optional[int]): Zero-based attachment position from
            the message-content response. Lets the server resolve Gmail's
            refreshed attachment IDs against current metadata before every
            download, selecting the current attachment ID, filename and MIME type.

    Returns:
        str: Attachment metadata with either a local file path or download URL,
            optionally followed by a base64 content block when
            ``return_base64=True``.
get_gmail_message_contenttool Retrieves the full content (subject, sender, recipients, body) of a specific Gmail message.Networkread-only (declared)
Retrieves the full content (subject, sender, recipients, body) of a specific Gmail message.

    Set page_offset=0 to read the complete rendered body, excluding attachments and
    attached messages, as JSON pages of at most page_size characters. Follow
    next_offset until complete=true, passing body_sha256 as expected_sha256 and
    keeping body_format and include_links unchanged.

    Bodies are returned inline and truncated at 20,000 characters. Set full=True to
    get the complete, untruncated message instead: it is exported to storage and the
    response carries a short-lived download URL (HTTP transport) or file path (stdio
    transport) rather than the body, so large messages never stream through the model
    context. Stateless deployments without GCS staging have no storage, so there
    full=True returns the untruncated body inline; with GCS staging configured it
    returns a signed download URL like any other HTTP deployment.

    Args:
        message_id (str): The unique ID of the Gmail message to retrieve.
        user_google_email (str): The user's Google email address. Required.
        body_format (Literal["text", "html", "raw"]): Body output format (only applies
            when format='full').
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches the full raw MIME message and returns the base64url-decoded content.
        full (bool): When True, write the untruncated message to storage and
            return its URL/path instead of the body. body_format selects the exported
            file type: "raw" saves the byte-exact RFC 5322 message as .eml, "html"
            saves the raw HTML body, "text" saves the plaintext body. The "html"/"text"
            exports are re-encoded as UTF-8 from the declared charset, so prefer "raw" when
            byte-exact fidelity matters. In stateless mode without GCS staging there is
            no storage to write to, so the untruncated content is returned inline
            instead; with GCS staging it is saved and returned as a signed URL.
        format (Literal["full", "metadata"]): Message format. "full" (default) includes
            the body and attachments, "metadata" only headers.
        include_headers (bool): When False, omit the Subject/From/To/Date header
            summary (attached messages' too), and with full=True name the export
            after the message ID. Requires format='full'; body_format='raw' is only
            allowed when the raw message is exported to a file.
        include_links (bool): Append the HTML body's http(s) links missing from the text output.
        page_offset (int): Start position in the complete rendered body. Requires
            format="full", full=False, and body_format="text" or "html".
        page_size (int): Maximum body characters per page, between 1 and 20,000.
        expected_sha256 (str): Optional previous body_sha256; rejects changed content.

    Returns:
        str: The message details including subject, sender, date, Message-ID, recipients
            (To, Cc), and body content — or, when full=True, the saved file's download
            URL or path in place of the body (inline only in stateless mode without
            GCS staging).
get_gmail_messages_content_batchtool Retrieves the content of multiple Gmail messages in a single batch request.Networkread-only (declared)
Retrieves the content of multiple Gmail messages in a single batch request.
    Supports up to 25 messages per batch to prevent SSL connection exhaustion.

    Args:
        message_ids (List[str]): List of Gmail message IDs to retrieve; fetched in batches of 25.
        user_google_email (str): The user's Google email address. Required.
        format (Literal["full", "metadata"]): Message format. "full" includes body, "metadata" only headers.
        body_format (Literal["text", "html", "raw"]): Body output format (only applies when format='full').
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches the full raw MIME message and returns the base64url-decoded content.
        include_links (bool): Append the HTML body's http(s) links missing from the text output.

    Returns:
        str: A formatted list of message contents including subject, sender, date, Message-ID, recipients (To, Cc), and body (if full format).
get_gmail_thread_contenttool Retrieves the complete content of a Gmail conversation thread, including all messages.Networkread-only (declared)
Retrieves the complete content of a Gmail conversation thread, including all messages.

    Optionally also returns structured ownership analysis so a caller can
    determine who sent the last message and who owes whom a response without
    re-parsing the formatted string or making a second tool call.

    Args:
        thread_id (str): The unique ID of the Gmail thread to retrieve.
        user_google_email (str): The user's Google email address. Required.
        body_format (Literal["text", "html", "raw"]): Body output format.
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches each message's full raw MIME content and returns the base64url-decoded body.
        include_analysis (bool): When True, returns a dict containing both the
            formatted thread content and structured ownership analysis. When
            False (default), returns the formatted content string (existing
            behavior, unchanged).
        include_links (bool): Append the HTML body's http(s) links missing from the text output.

    Returns:
        str: When `include_analysis=False` (default). The complete thread
        content with all messages formatted for reading.

        Dict[str, Any]: When `include_analysis=True`. A dict with keys
            "content" (str) and "analysis" (dict). See
            `_analyze_thread_ownership_impl` for the analysis schema.
get_gmail_threads_content_batchtool Retrieves the content of multiple Gmail threads in a single batch request.Networkread-only (declared)
Retrieves the content of multiple Gmail threads in a single batch request.
    Supports up to 25 threads per batch to prevent SSL connection exhaustion.

    Args:
        thread_ids (List[str]): A list of Gmail thread IDs to retrieve. The function will automatically batch requests in chunks of 25.
        user_google_email (str): The user's Google email address. Required.
        body_format (Literal["text", "html", "raw"]): Body output format.
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches each message's full raw MIME content and returns the base64url-decoded body.
        include_links (bool): Append the HTML body's http(s) links missing from the text output.

    Returns:
        str: A formatted list of thread contents with separators.
get_messagestool Retrieves messages from a Google Chat space.read-only (declared)
Retrieves messages from a Google Chat space.

    Args:
        message_filter: Optional filter string using the Chat API filter syntax.
                        Supports createTime and thread.name.
                        Examples:
                          'createTime > "2026-03-18T00:00:00-03:00"'
                          'createTime > "2026-03-18T00:00:00-03:00" AND createTime < "2026-03-19T00:00:00-03:00"'
                          'thread.name = spaces/X/threads/Y'
        page_token: Token for the next page, taken from a previous response. Keep all other arguments unchanged.

    Returns:
        str: Formatted messages from the specified space. When more messages
            remain, a "Next page token" line is appended.
get_presentationtool Read a deck: action "deck" (default) lists its slides and layouts, "page" gives one slide's element IDs and all its text (start here for content), "markup" giveread-only (declared)
Read a deck: action "deck" (default) lists its slides and layouts, "page" gives one slide's element IDs and all its text (start here for content), "markup" gives one slide's elements as compact JSON with geometry and styles, "layouts" lists every layout.

    Actions:
        - "deck": Title, URL, revision, and per slide its ID, title, layout,
          element counts and notes length; then the deck's layouts with the
          placeholders each provides. Lists 100 slides per call; a longer deck
          ends with the offset to call again with. Uses offset.
        - "layouts": Every layout, grouped by master, with its placeholders
          and the slides using it. Only needed when "deck" says there are
          more layouts than it lists. Uses after.
        - "page": Every element on one slide with its ID, in z-order, groups
          nested, with all text, table cells, image sources and speaker notes.
          No geometry or styling. Requires page_id.
        - "markup": One slide, or chosen elements, as JSON: boxes in points
          ({"x","y","w","h"}), text as paragraphs and runs, styles in a shared
          "styles" table referenced by "s", only locally set properties.
          A shape with no "shape" key is a TEXT_BOX. Requires page_id; uses
          targets and raw.

    Args:
        user_google_email (str): The user's Google email address. Required.
        presentation_id (str): The ID of the presentation.
        action (str): "deck" (default): slides and layouts. "page": one
            slide's element IDs and text. "markup": one slide's elements as
            JSON with geometry and styles. "layouts": every layout.
        page_id (Optional[str]): Slide (or any page) object ID, from "deck".
            Required for "page" and "markup".
        targets (Optional[List[str]]): For "markup": element IDs to return
            instead of the whole slide, plus "notes" for the speaker notes.
            A target inside a group comes back with page coordinates and its
            "group" ID; a group comes back with its children.
        raw (bool): For "markup": return the Slides API Page resource itself
            (EMU, transforms, text indices), limited to targets when given,
            for writing raw batch_update_presentation requests. A target in a
            group keeps its group-relative transform. Defaults to False.
        offset (int): For "deck": index of the first slide to list, from the
            note at the end of a previous call. Defaults to 0.
        after (Optional[str]): For "layouts": a slide ID, or "start". Lists
            only the layouts of the master in use at that position, which are
            the only ones a new slide inserted there can use.

    Returns:
        str: The deck or layout digest, the page digest, or the markup JSON.
get_script_activitytool Read execution activity for scripts: recent processes or aggregate metrics.read-only (declared)
Read execution activity for scripts: recent processes or aggregate metrics.

    Actions:
        - "processes": List recent execution processes. Without script_id, lists
          the user's own recent runs; with script_id, lists all processes for
          that script visible to the user (including runs by others). Optional
          page_size.
        - "metrics": Get aggregate execution metrics (active users, total and
          failed executions) for one script. Requires script_id; optional
          metrics_granularity ("DAILY" or "WEEKLY").

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: One of "processes", "metrics".
        script_id: The script project ID (required for metrics; optional for
            processes).
        page_size: Number of results for processes (default: 50).
        metrics_granularity: Granularity for metrics - "DAILY" or "WEEKLY".

    Returns:
        str: Formatted process list or metrics data.
get_script_projecttool Read Apps Script projects and their source files.read-only (declared)
Read Apps Script projects and their source files.

    Actions:
        - "list": List Apps Script projects accessible to the user (Drive-backed).
          Optional: page_size, page_token.
        - "get": Retrieve one project's metadata and file overview, or one
          complete source file when file_name is provided. Requires script_id.

    Args:
        drive_service: Injected Drive client (used for list).
        script_service: Injected Script client (used for get).
        user_google_email: User's email address
        action: One of "list", "get".
        script_id: The script project ID (required for get).
        file_name: Optional source file name for get.
        page_size: Number of results per page for list (default: 50).
        page_token: Pagination token for list (optional).

    Returns:
        str: Formatted result for the requested action.
get_script_versiontool List or retrieve immutable version snapshots of a script project.read-only (declared)
List or retrieve immutable version snapshots of a script project.

    Actions:
        - "list": List every version of the project.
        - "get": Retrieve one version. Requires version_number.
get_search_engine_infotool Retrieves metadata about a Programmable Search Engine.CredentialsEnv varsSensitive pathsread-only (declared)
Retrieves metadata about a Programmable Search Engine.

    Args:
        user_google_email (str): The user's Google email address. Required.

    Returns:
        str: Information about the search engine including its configuration and available refinements.
get_spreadsheet_infotool Gets information about a specific spreadsheet including its sheets.read-only (declared)
Gets information about a specific spreadsheet including its sheets.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet to get info for. Required.

    Returns:
        str: Formatted spreadsheet information including title, locale, and sheets list.
get_tasktool Get details of a specific task.read-only (declared)
Get details of a specific task.

    Args:
        user_google_email (str): The user's Google email address. Required.
        task_list_id (str): The ID of the task list containing the task.
        task_id (str): The ID of the task to retrieve.

    Returns:
        str: Task details including title, notes, status, due date, etc.
get_task_listtool Get details of a specific task list.read-only (declared)
Get details of a specific task list.

    Args:
        user_google_email (str): The user's Google email address. Required.
        task_list_id (str): The ID of the task list to retrieve.

    Returns:
        str: Task list details including title, ID, and last updated time.
import_to_google_doctool Imports a file (Markdown, DOCX, TXT, HTML, RTF, ODT) into Google Docs format with automatic conversion.FilesCredentialsEnv varsSensitive pathsoutside text
Imports a file (Markdown, DOCX, TXT, HTML, RTF, ODT) into Google Docs format with automatic conversion.

    Google Drive automatically converts the source file to native Google Docs format,
    preserving formatting like headings, lists, bold, italic, etc.
    Binary sources may be passed directly as base64_content. On a local server a
    file on disk can also be passed by path (preferred for batch operations, so
    callers do not need to load full file contents into their context).

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new Google Doc; the extension is dropped from the title. Without 'source_format', its extension also sets the format of 'content' or 'base64_content' (e.g. 'Notes.md' so Markdown tables are not imported as plain text).
        content (Optional[str]): Text content for text-based formats. Use only for short snippets or content already in memory.
        file_path (Optional[str]): Local file path or file:// URL for any supported format (MD, TXT, HTML, DOCX, ODT, RTF). Appropriate for larger files than content, but file_path may still load the file into memory or perform non-streaming reads. Avoid very large files that could exceed memory or time limits; use streaming/chunked uploads or an alternative API for huge files.
        file_url (Optional[str]): Remote URL to fetch the file from (http/https).
        source_format (Optional[str]): Source format hint ('md', 'markdown', 'docx', 'txt', 'html', 'rtf', 'odt').
                                       Auto-detected from file_name extension if not provided.
        folder_id (str): The ID of the parent folder. Defaults to 'root'.
        base64_content (Optional[str]): Standard base64-encoded bytes for a binary source such as DOCX or ODT.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL instead of ingesting the source here; the caller PUTs the source bytes there directly (no Authorization header) and Drive converts them. Requires source_format; not combinable with other content sources. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with the new Google Doc link, or the resumable upload URL.

    Examples:
        # Import a markdown file from disk (preferred for batch operations)
        import_to_google_doc(file_name="My Doc.md", file_path="/path/to/my-doc.md", source_format="md")

        # Import markdown content directly
        import_to_google_doc(file_name="My Doc.md", content="# Title\\n\\nHello **world**")

        # Import a local DOCX file
        import_to_google_doc(file_name="Report", file_path="/path/to/report.docx")

        # Import from URL
        import_to_google_doc(file_name="Remote Doc", file_url="https://example.com/doc.md")

        # Get an upload URL and PUT a DOCX to it directly (hosted servers, large files)
        import_to_google_doc(file_name="Report", source_format="docx", return_upload_url=True)
import_to_google_sheetstool Imports a spreadsheet (XLSX, XLS, ODS, CSV, TSV) into Google Sheets format with automatic conversion.FilesCredentialsEnv varsSensitive pathsoutside text
Imports a spreadsheet (XLSX, XLS, ODS, CSV, TSV) into Google Sheets format with automatic conversion.

    Google Drive automatically converts the source spreadsheet to native Google Sheets format,
    preserving rows, columns, sheets, and values.
    Binary sources may be passed directly as base64_content. On a local server a
    file on disk can also be passed by path (preferred for batch operations, so
    callers do not need to load full file contents into their context).

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new Google Sheets spreadsheet; the extension is dropped from the title. Without 'source_format', its extension also sets the format of 'content' or 'base64_content' (e.g. 'Data.csv').
        content (Optional[str]): Text content for text-based formats (CSV, TSV). Use only for short snippets or content already in memory.
        file_path (Optional[str]): Local file path or file:// URL for any supported format (XLSX, XLS, ODS, CSV, TSV). Appropriate for larger files than content, but file_path may still load the file into memory or perform non-streaming reads. Avoid very large files that could exceed memory or time limits; use streaming/chunked uploads or an alternative API for huge files.
        file_url (Optional[str]): Remote URL to fetch the spreadsheet from (http/https).
        source_format (Optional[str]): Source format hint ('xlsx', 'xls', 'ods', 'csv', 'tsv').
                                       Auto-detected from file_name extension if not provided.
        folder_id (str): The ID of the parent folder. Defaults to 'root'.
        base64_content (Optional[str]): Standard base64-encoded bytes for an XLSX, XLS, or ODS source.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL instead of ingesting the source here; the caller PUTs the source bytes there directly (no Authorization header) and Drive converts them. Requires source_format; not combinable with other content sources. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with the new Google Sheets link, or the resumable upload URL.

    Examples:
        # Import a local Excel file (preferred for batch operations)
        import_to_google_sheets(file_name="Budget", file_path="/path/to/budget.xlsx")

        # Import CSV content directly
        import_to_google_sheets(file_name="Data.csv", content="a,b,c\\n1,2,3", source_format="csv")

        # Import from URL
        import_to_google_sheets(file_name="Remote Sheet", file_url="https://example.com/data.xlsx")

        # Get an upload URL and PUT an XLSX to it directly (hosted servers, large files)
        import_to_google_sheets(file_name="Budget", source_format="xlsx", return_upload_url=True)
import_to_google_slidestool Imports a presentation (PPTX, PPT, ODP) into Google Slides format with automatic conversion.FilesCredentialsEnv varsSensitive pathsoutside text
Imports a presentation (PPTX, PPT, ODP) into Google Slides format with automatic conversion.

    Google Drive automatically converts the source presentation to native Google Slides format,
    preserving slides, layouts, text, and images.
    Binary sources may be passed directly as base64_content. On a local server a
    file on disk can also be passed by path (preferred for batch operations, so
    callers do not need to load full file contents into their context).

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new Google Slides presentation; the extension is dropped from the title. Without 'source_format', its extension also sets the format of 'base64_content' (e.g. 'Deck.pptx').
        file_path (Optional[str]): Local file path or file:// URL for any supported format (PPTX, PPT, ODP). Appropriate for larger files than content, but file_path may still load the file into memory or perform non-streaming reads. Avoid very large files that could exceed memory or time limits; use streaming/chunked uploads or an alternative API for huge files.
        file_url (Optional[str]): Remote URL to fetch the presentation from (http/https).
        source_format (Optional[str]): Source format hint ('pptx', 'ppt', 'odp').
                                       Auto-detected from file_name extension if not provided.
        folder_id (str): The ID of the parent folder. Defaults to 'root'.
        base64_content (Optional[str]): Standard base64-encoded bytes for a PPTX or ODP source.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL instead of ingesting the source here; the caller PUTs the source bytes there directly (no Authorization header) and Drive converts them. Requires source_format; not combinable with other content sources. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with the new Google Slides link, or the resumable upload URL.

    Examples:
        # Import a local PowerPoint file (preferred for batch operations)
        import_to_google_slides(file_name="Deck", file_path="/path/to/deck.pptx")

        # Import from URL
        import_to_google_slides(file_name="Remote Deck", file_url="https://example.com/deck.pptx")

        # Get an upload URL and PUT a PPTX to it directly (hosted servers, large files)
        import_to_google_slides(file_name="Deck", source_format="pptx", return_upload_url=True)
insert_doc_elementstool Inserts structural elements like tables, lists, or page breaks into a Google Doc.
Inserts structural elements like tables, lists, or page breaks into a Google Doc.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        element_type: Type of element to insert ("table", "list", "page_break")
        index: Position to insert element (0-based)
        rows: Number of rows for table (required for table)
        columns: Number of columns for table (required for table)
        list_type: Type of list ("UNORDERED", "ORDERED") (required for list)
        text: Initial text content for list items

    Returns:
        str: Confirmation message with insertion details
insert_doc_imagetool Inserts an image into a Google Doc from Drive or a URL.
Inserts an image into a Google Doc from Drive or a URL.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        image_source: Drive file ID or public image URL
        index: Position to insert image (0-based)
        width: Image width in points (optional)
        height: Image height in points (optional)

    Returns:
        str: Confirmation message with insertion details
inspect_doc_structuretool Essential tool for finding safe insertion points and understanding document structure.read-only (declared)
Essential tool for finding safe insertion points and understanding document structure.

    USE THIS FOR:
    - Finding the correct index for table insertion
    - Understanding document layout before making changes
    - Locating existing tables and their positions
    - Getting document statistics and complexity info
    - Inspecting structure of specific tabs

    CRITICAL FOR TABLE OPERATIONS:
    ALWAYS call this BEFORE creating tables to get a safe insertion index.

    WHAT THE OUTPUT SHOWS:
    - total_elements: Number of document elements
    - total_length: Maximum safe index for insertion
    - tables: Number of existing tables
    - table_details: Position and dimensions of each table
    - headers / footers: Real segment IDs and previews for header/footer editing
    - tabs: List of available tabs in the document (if no tab_id specified)
    - empty_paragraphs: newline-only count, excluding existing/suggested object anchors
    - empty_paragraph_ranges: start/end extents, capped at 100
    - empty_paragraph_ranges_truncated: whether ranges were omitted
    - last_paragraph: is_list_item and is_empty, or null if no body paragraphs

    Paragraph statistics cover top-level body paragraphs and appear at the top
    level in basic mode or under "statistics" in detailed mode.
    Ranges can include required empty paragraphs. Before cleanup, use detailed=true
    to check adjacent elements, formatting, and object anchors. Preserve the final
    newline and newlines before tables, tables of contents, or section breaks.
    If the body ends with an empty paragraph, that paragraph's range has
    end == total_length; truncation may omit that range.

    WORKFLOW FOR TABLE INSERTION:
    Step 1: Call this function
    Step 2: Note the "total_length" value
    Step 3: Use an index < total_length for table insertion
    Step 4: Create your table

    FORMATTING WORKFLOW:
    After inserting all text via batch_update_doc with end_of_segment=true,
    call this tool with detailed=true to get exact start_index and end_index
    for every paragraph. Use those indices directly in format_text and
    update_paragraph_style operations in a second batch_update_doc call.

    HEADER/FOOTER WORKFLOW:
    For ordinary header/footer text, use update_doc_headers_footers.
    If you need low-level segment editing, call this tool first and use the
    real segment_id values returned under headers/footers. Do not invent IDs.

    The detailed output includes elements[].start_index and elements[].end_index
    with text_preview for each paragraph, making it easy to identify which
    ranges to format.

    SUB-PARAGRAPH FORMATTING:
    text_preview is truncated to 100 characters by default. To compute the index
    of a token inside a longer paragraph, pass preview_chars=0 or None for untruncated
    text, then add the token's UTF-16 offset within that text to the paragraph's
    start_index (non-BMP characters such as emoji occupy two UTF-16 units).

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to inspect
        detailed: Whether to return detailed structure information
        tab_id: Optional ID of the tab to inspect. If not provided, inspects main document.
        preview_chars: Maximum characters of paragraph, header and footer text
            preview. Pass 0 or None for the full text, needed to locate a token inside a
            paragraph longer than the default 100 characters.

    Returns:
        str: JSON string containing document structure and safe insertion indices
list_calendarstool Retrieves a list of calendars accessible to the authenticated user.read-only (declared)
Retrieves a list of calendars accessible to the authenticated user.

    Args:
        user_google_email (str): The user's Google email address. Required.
        max_results (Optional[int]): Maximum calendars to return in one page. Omit to use the API default.
        page_token (Optional[str]): Token for the next page, taken from a previous response.

    Returns:
        str: A formatted list of the user's calendars (summary, ID, primary status, time zone).
            When more calendars remain, a "Next page token" line is appended.
list_commentstool
No description.
list_contact_groupstool List contact groups (labels) for the user.read-only (declared)
List contact groups (labels) for the user.

    Args:
        user_google_email (str): The user's Google email address. Required.
        page_size (int): Maximum number of groups to return (default: 100, max: 1000).
        page_token (Optional[str]): Token for pagination.

    Returns:
        str: List of contact groups with their details.
list_contactstool List contacts for the authenticated user, optionally as a full or incremental sync.read-only (declared)
List contacts for the authenticated user, optionally as a full or incremental sync.

    Args:
        user_google_email (str): The user's Google email address. Required.
        page_size (int): Maximum number of contacts to return (default: 100, max: 1000).
        page_token (Optional[str]): Token for pagination. Keep all other arguments unchanged when following it.
        sort_order (Optional[str]): Sort order: "LAST_MODIFIED_ASCENDING", "LAST_MODIFIED_DESCENDING", "FIRST_NAME_ASCENDING", or "LAST_NAME_ASCENDING". Not supported when syncing.
        request_sync_token (bool): Start a full sync. The last page returns a sync token.
        sync_token (Optional[str]): List only changes since the sync that returned this token, marking deleted contacts. The last page returns a new sync token.

    Returns:
        str: List of contacts with their basic information.
list_docs_in_foldertool Lists Google Docs within a specific Drive folder.read-only (declared)
Lists Google Docs within a specific Drive folder.

    Args:
        user_google_email: The user's Google email address.
        folder_id: ID of the Drive folder to list. Defaults to 'root'.
        page_size: Maximum number of documents to return. Defaults to 100.
        page_token: Page token from a previous response's nextPageToken to
            retrieve the next page of results.

    Returns:
        str: A formatted list of Google Docs in the specified folder.
            Includes a nextPageToken line when more results are available.
list_drive_itemstool Lists files/folders or shared drive containers, supporting shared drives.Networkread-only (declared)
Lists files/folders or shared drive containers, supporting shared drives.
    If `drive_id` is specified, lists items within that shared drive. `folder_id` is then relative to that drive (or use drive_id as folder_id for root).
    If `drive_id` is not specified, lists items from user's "My Drive" and accessible shared drives (if `include_items_from_all_drives` is True).
    Set `resource_type` to "shared_drives" to list shared drive containers instead of folder contents.

    Args:
        user_google_email (str): The user's Google email address. Required.
        folder_id (str): The ID of the Google Drive folder. Defaults to 'root'. For a shared drive, this can be the shared drive's ID to list its root, or a folder ID within that shared drive.
        page_size (int): The maximum number of items to return. Defaults to 100.
        page_token (Optional[str]): Page token from a previous response's nextPageToken to retrieve the next page of results.
        drive_id (Optional[str]): ID of the shared drive. If provided, the listing is scoped to this drive.
        include_items_from_all_drives (bool): Whether items from all accessible shared drives should be included if `drive_id` is not set. Defaults to True.
        corpora (Optional[str]): Corpus to query ('user', 'drive', 'allDrives'). If `drive_id` is set and `corpora` is None, 'drive' is used. If None and no `drive_id`, 'allDrives' is used when `include_items_from_all_drives` is True.
        file_type (Optional[str]): Restrict results to a specific file type. Accepts a friendly
                                   name ('folder', 'document'/'doc', 'spreadsheet'/'sheet',
                                   'presentation'/'slides', 'form', 'drawing', 'pdf', 'shortcut',
                                   'script', 'site', 'jam'/'jamboard') or any raw MIME type
                                   string (e.g. 'application/pdf'). Defaults to None (all types).
        detailed (bool): Whether to include size, modified time, and link in results. Defaults to True.
        order_by (Optional[str]): Sort order. Comma-separated list of sort keys with optional 'desc' modifier.
                                  Valid keys: 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime',
                                  'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime',
                                  'starred', 'viewedByMeTime'. Example: 'modifiedTime desc' or 'folder,modifiedTime desc,name'.
                                  Defaults to None (Drive API default ordering).
        resource_type (str): What to list. Use "items" for folder contents or
                             "shared_drives" for shared drive containers. Defaults to "items".
        query (Optional[str]): Shared drive query used only when resource_type="shared_drives",
                               e.g. "name contains 'Engineering'".
        include_organizers (bool): When resource_type="shared_drives", include principals
                                   with the organizer role. This costs one extra permissions.list
                                   API call per shared drive returned. Defaults to False.

    Returns:
        str: A formatted list of files/folders in the specified folder or shared drives.
             Includes a nextPageToken line when more results are available.
list_form_responsestool List a form's responses.read-only (declared)
List a form's responses.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form.
        page_size (int): Maximum number of responses to return. Defaults to 10.
        page_token (Optional[str]): Token for retrieving next page of results.

    Returns:
        str: List of responses with basic details and pagination info.
list_gmail_filterstool Lists all Gmail filters configured in the user's mailbox.read-only (declared)
Lists all Gmail filters configured in the user's mailbox.

    Args:
        user_google_email (str): The user's Google email address. Required.

    Returns:
        str: A formatted list of filters with their criteria and actions.
list_gmail_labelstool Lists labels in the user's Gmail account.read-only (declared)
Lists labels in the user's Gmail account.

    Args:
        user_google_email (str): The user's Google email address. Required.
        prefix (Optional[str]): Return only labels whose name starts with this
            exact (case-sensitive) string. users.labels.list accepts no filter,
            so the full list is fetched and narrowed here: this shrinks what the
            caller receives, not the API call.
        compact (bool): Return minimal JSON {"count", "labels": [{"id", "name"}]}
            sorted by name, instead of the formatted text list. For callers
            that parse the result, e.g. a label cache refresh.
        include_system (bool): Include Gmail system labels (INBOX, SENT, ...).
            Set False to return user labels only.

    Returns:
        str: A formatted list of labels, or minimal JSON when compact=True.
list_script_deploymentstool List deployments for an Apps Script project.read-only (declared)
List deployments for an Apps Script project.
list_sheet_tablestool Lists all structured tables in a spreadsheet with their IDs, names, ranges,read-only (declared)
Lists all structured tables in a spreadsheet with their IDs, names, ranges,
    and column details. Use this to find table IDs for append_table_rows.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.

    Returns:
        str: Formatted list of tables with their IDs, names, ranges, and columns.
list_spacestool Lists Google Chat spaces (rooms and direct messages) accessible to the user,read-only (declared)
Lists Google Chat spaces (rooms and direct messages) accessible to the user,
    or the members of one space.

    Args:
        space_id: Space (spaces/X or a bare ID X) whose members to list instead
            of spaces, up to page_size: people, apps and groups with role and
            invite state.

    Returns:
        str: A formatted list of Google Chat spaces, or of the members of space_id.
list_spreadsheetstool Lists spreadsheets from Google Drive that the user has access to.read-only (declared)
Lists spreadsheets from Google Drive that the user has access to.

    Args:
        user_google_email (str): The user's Google email address. Required.
        max_results (int): Maximum number of spreadsheets to return. Defaults to 25.
        page_token (Optional[str]): Page token from a previous response's nextPageToken to retrieve the next page of results.
        corpora (Optional[str]): Corpus to search ('user', 'domain', 'drive', 'allDrives').
            Defaults to 'drive' when drive_id is set, otherwise 'allDrives'.
        drive_id (Optional[str]): Shared drive ID to search.

    Returns:
        str: A formatted list of spreadsheet files (name, ID, modified time).
             Includes a nextPageToken line when more results are available.
list_task_liststool List all task lists for the user.read-only (declared)
List all task lists for the user.

    Args:
        user_google_email (str): The user's Google email address. Required.
        max_results (int): Maximum number of task lists to return (default: 1000, max: 1000).
        page_token (Optional[str]): Token for pagination.

    Returns:
        str: List of task lists with their IDs, titles, and details.
list_taskstool List all tasks in a specific task list.read-only (declared)
List all tasks in a specific task list.

    Args:
        user_google_email (str): The user's Google email address. Required.
        task_list_id (str): The ID of the task list to retrieve tasks from.
        max_results (int): Maximum number of tasks to return. (default: 20, max: 10000).
        page_token (Optional[str]): Token for pagination.
        show_completed (bool): Whether to include completed tasks (default: True). Note that show_hidden must also be true to show tasks completed in first party clients, such as the web UI and Google's mobile apps.
        show_deleted (bool): Whether to include deleted tasks (default: False).
        show_hidden (bool): Whether to include hidden tasks (default: False).
        show_assigned (bool): Whether to include assigned tasks (default: False).
        completed_max (Optional[str]): Upper bound for completion date (RFC 3339 timestamp).
        completed_min (Optional[str]): Lower bound for completion date (RFC 3339 timestamp).
        due_max (Optional[str]): Upper bound for due date (RFC 3339 timestamp).
        due_min (Optional[str]): Lower bound for due date (RFC 3339 timestamp).
        updated_min (Optional[str]): Lower bound for last modification time (RFC 3339 timestamp).

    Returns:
        str: List of tasks with their details.
manage_calendartool Creates secondary Google Calendars and manages who a calendar is shared with (its access control rules).destructive (declared)
Creates secondary Google Calendars and manages who a calendar is shared with (its access control rules).

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform. One of:
            - "create": Create a new secondary calendar. Uses summary, description, timezone.
            - "list_sharing": List the calendar's sharing rules. Uses calendar_id, page_token.
            - "share": Grant access to the calendar. Uses calendar_id, role, scope_type, scope_value, send_notifications.
            - "update_sharing": Change the role of an existing rule. Uses calendar_id, rule_id, role, send_notifications.
            - "unshare": Remove an existing rule. Uses calendar_id, rule_id.
        summary (Optional[str]): The title/name of the new calendar. Required for "create".
        description (Optional[str]): An optional description for the new calendar. Used by "create".
        timezone (Optional[str]): IANA timezone for the new calendar (e.g. 'America/New_York'). Used by "create".
        calendar_id (str): Calendar ID for the sharing actions. Defaults to 'primary'.
        role (Optional[str]): Access level for "share" and "update_sharing". One of: "freeBusyReader", "reader", "writerWithoutPrivateAccess", "writer", "owner", "none".
        scope_type (str): Who "share" grants access to: "user", "group", "domain", or "default" (public). Defaults to "user".
        scope_value (Optional[str]): Email address for "user"/"group" or domain name for "domain". Required for "share" unless scope_type is "default".
        rule_id (Optional[str]): Rule ID from "list_sharing" (e.g. "user:[email protected]"). Required for "update_sharing" and "unshare".
        send_notifications (bool): Whether to email the grantee on "share" and "update_sharing". Defaults to True.
        page_token (Optional[str]): For "list_sharing" action: token for the next page, taken from a previous response.

    Returns:
        str: The new calendar's summary and ID, the calendar's sharing rules, or a confirmation of the rule that changed.
manage_commenttool
No description.
manage_conditional_formattingtool Manages conditional formatting rules on a Google Sheet. Supports adding,Networkdestructive (declared)
Manages conditional formatting rules on a Google Sheet. Supports adding,
    updating, and deleting conditional formatting rules via a single tool.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        action (str): The operation to perform. Must be one of "add", "update",
            or "delete".
        range_name (Optional[str]): A1-style range (optionally with sheet name).
            Required for "add". Optional for "update" (preserves existing ranges
            if omitted). Not used for "delete".
        condition_type (Optional[str]): Sheets condition type (e.g., NUMBER_GREATER,
            TEXT_CONTAINS, DATE_BEFORE, CUSTOM_FORMULA). Required for "add".
            Optional for "update" (preserves existing type if omitted).
        condition_values (Optional[Union[str, List[Union[str, int, float]]]]): Values
            for the condition; accepts a list or a JSON string representing a list.
            Depends on condition_type. Used by "add" and "update".
        background_color (Optional[str]): Hex background color to apply when
            condition matches. Used by "add" and "update".
        text_color (Optional[str]): Hex text color to apply when condition matches.
            Used by "add" and "update".
        rule_index (Optional[int]): 0-based index of the rule. For "add", optionally
            specifies insertion position. Required for "update" and "delete".
        gradient_points (Optional[Union[str, List[dict]]]): List (or JSON list) of
            gradient points for a color scale. If provided, a gradient rule is created
            and boolean parameters are ignored. Used by "add" and "update".
        sheet_name (Optional[str]): Sheet name to locate the rule when range_name is
            omitted. Defaults to the first sheet. Used by "update" and "delete".

    Returns:
        str: Confirmation of the operation and the current rule state.
manage_contacttool Create, update, or delete a contact. Consolidated tool replacing create_contact,destructive (declared)
Create, update, or delete a contact. Consolidated tool replacing create_contact,
    update_contact, and delete_contact.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform: "create", "update", or "delete".
        contact_id (Optional[str]): The contact ID. Required for "update" and "delete" actions.
        given_name (Optional[str]): First name (for create/update).
        family_name (Optional[str]): Last name (for create/update).
        phones (Optional[List[Dict]]): List of phone dicts {number, type?}.
            Supported types: mobile, work, home, main, workMobile, internal, other, etc.
            Use type="internal" for internal PBX/ATS short numbers (e.g. 250, 301) — stored
            as a standalone number without + prefix, displayed as "Internal: 250".
        emails (Optional[List[Dict]]): List of email dicts {address, type?}.
        organizations (Optional[List[Dict]]): List of org dicts {name?, title?, department?, jobDescription?, type?}.
        nicknames (Optional[List[Dict]]): List of nickname dicts {value, type?}.
            Useful for bilingual contacts (e.g. Hebrew/English alternative forms). Android dialer
            and WhatsApp search both index nicknames, enabling cross-script lookup.
            Supported types: default, alternate_name, maiden_name, initials, other, etc.
        urls (Optional[List[Dict]]): List of URL dicts {value, type?}.
            Supported types: homepage, blog, profile, work, ftp, reservations, other, etc.
        user_defined (Optional[List[Dict]]): List of custom field dicts {key, value}.
            Useful for structured data like account numbers, IDs, or custom dates.
        relations (Optional[List[Dict]]): List of relation dicts {person, type?}.
            Supported types: spouse, child, parent, friend, manager, assistant, etc.
        notes (Optional[str]): Additional notes (for create/update).
        address (Optional[str]): Street address, replacing any existing addresses. "" clears them (for create/update).
        birthday (Optional[str]): Birthday as 'YYYY-MM-DD', 'MM-DD' (no year), or 'clear'/'' to remove.
        phones_mode (str): How to update phones on "update": "merge" (default), "replace", or "remove".
            merge = read-modify-write with dedup by canonicalForm/normalized value.
            replace = overwrite all phones with provided list.
            remove = delete phones matching provided numbers.
        emails_mode (str): How to update emails on "update": "merge" (default), "replace", or "remove".
        organizations_mode (str): How to update orgs on "update": "merge" (default), "replace", or "remove".
        nicknames_mode (str): How to update nicknames on "update": "merge" (default), "replace", or "remove".
        urls_mode (str): How to update urls on "update": "merge" (default), "replace", or "remove".
            merge and remove match URLs case-insensitively on scheme and host only, ignoring a trailing slash.
        user_defined_mode (str): How to update custom fields on "update": "merge" (default), "replace", or "remove".
            merge overrides value on matching key; new keys appended.
        relations_mode (str): How to update relations on "update": "merge" (default), "replace", or "remove".
        phone (Optional[str]): [DEPRECATED] Single phone number. Use phones=[{"number":..., "type":"mobile"}].
        email (Optional[str]): [DEPRECATED] Email address. Use emails=[{"address":..., "type":"other"}].
        organization (Optional[str]): [DEPRECATED] Company name. Use organizations=[{"name":...}].
        job_title (Optional[str]): [DEPRECATED] Job title. Use organizations=[{"title":...}].

    Returns:
        str: Result of the action performed.
manage_contact_grouptool Create, update, delete a contact group, or modify its members. Consolidated tooldestructive (declared)
Create, update, delete a contact group, or modify its members. Consolidated tool
    replacing create_contact_group, update_contact_group, delete_contact_group, and
    modify_contact_group_members.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform: "create", "update", "delete", or "modify_members".
        group_id (Optional[str]): The contact group ID. Required for "update", "delete",
            and "modify_members" actions.
        name (Optional[str]): The group name. Required for "create" and "update" actions.
        delete_contacts (bool): If True and action is "delete", also delete contacts in
            the group (default: False).
        add_contact_ids (Optional[List[str]]): Contact IDs to add (for "modify_members").
        remove_contact_ids (Optional[List[str]]): Contact IDs to remove (for "modify_members").

    Returns:
        str: Result of the action performed.
manage_contacts_batchtool Batch create, update, or delete contacts. Consolidated tool replacingdestructive (declared)
Batch create, update, or delete contacts. Consolidated tool replacing
    batch_create_contacts, batch_update_contacts, and batch_delete_contacts.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform: "create", "update", or "delete".
        contacts (Optional[List[Dict]]): List of contact dicts for "create" action.
            Each dict may contain: given_name, family_name, phones, emails,
            organizations, nicknames, urls, user_defined, relations, notes, address,
            birthday. Deprecated: phone, email, organization, job_title.
        updates (Optional[List[Dict]]): List of update dicts for "update" action.
            Each dict must contain contact_id and may contain the same fields as contacts.
        contact_ids (Optional[List[str]]): List of contact IDs for "delete" action.
        field (str): For "update" action, the single People API field to update across
            all contacts in this batch. Required. Must be one of: names, phoneNumbers,
            emailAddresses, organizations, nicknames, urls, userDefined, relations,
            biographies, addresses, birthdays. Using a single field per batch call prevents
            unintentional data loss from a union updateMask overwriting unrelated fields.

    Returns:
        str: Result of the batch action performed.
manage_deploymenttool Create, update, or delete Apps Script deployments.destructive (declared)
Create, update, or delete Apps Script deployments.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: Action to perform - "create", "update", or "delete"
        script_id: The script project ID
        deployment_id: The deployment ID (required for update and delete)
        description: Deployment description (required for create; optional for update
            when version_number is supplied)
        version_description: Optional version description (for create only)
        version_number: Version number to point the deployment at (for update only).
            Required to roll a deployment forward to a newly created script version.

    Returns:
        str: Formatted string with deployment details or confirmation
manage_doc_tabtool Manage document tabs: create, rename, delete, or populate from Markdown.destructive (declared)
Manage document tabs: create, rename, delete, or populate from Markdown.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document
        action: Action to perform - "create", "rename", "delete", or "populate_from_markdown"
        tab_id: Tab ID (required for rename, delete, populate_from_markdown; use inspect_doc_structure to find IDs)
        title: Tab title (required for create; used by rename)
        index: Position index for new tab, 0-based among siblings (required for create)
        parent_tab_id: Optional parent tab ID to nest under (create only)
        markdown_text: Markdown source to render (populate_from_markdown only)
        replace_existing: Clear tab body before inserting markdown (default True)

    Returns:
        dict with action result including document link
manage_drive_accesstool Consolidated tool for managing Google Drive file and folder access permissions.destructive (declared)
Consolidated tool for managing Google Drive file and folder access permissions.

    Supports granting, batch-granting, updating, revoking permissions, and
    transferring file ownership -- all through a single entry point.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file or folder. Required.
        action (str): The access management action to perform. Required. One of:
            - "grant": Share with a single user, group, domain, or anyone.
            - "grant_batch": Share with multiple recipients in one call.
            - "update": Modify an existing permission (role or expiration).
            - "revoke": Remove an existing permission.
            - "transfer_owner": Transfer file ownership to another user.
        share_with (Optional[str]): Email address (user/group), domain name (domain),
            or omit for 'anyone'. Used by "grant".
        role (Optional[str]): Permission role -- 'reader', 'commenter', or 'writer'.
            Used by "grant" (defaults to 'reader') and "update".
        share_type (str): Type of sharing -- 'user', 'group', 'domain', or 'anyone'.
            Used by "grant". Defaults to 'user'.
        permission_id (Optional[str]): The permission ID to modify or remove.
            Required for "update" and "revoke" actions.
        recipients (Optional[List[Dict[str, Any]]]): List of recipient objects for
            "grant_batch". Each should have: email (str), role (str, optional),
            share_type (str, optional), expiration_time (str, optional). For domain
            shares use 'domain' field instead of 'email'.
        send_notification (bool): Whether to send notification emails. Defaults to True.
            Used by "grant" and "grant_batch".
        email_message (Optional[str]): Custom notification email message.
            Used by "grant" and "grant_batch".
        expiration_time (Optional[str]): Expiration in RFC 3339 format
            (e.g., "2025-01-15T00:00:00Z"). Used by "grant" and "update".
        allow_file_discovery (Optional[bool]): For 'domain'/'anyone' shares, whether
            the file appears in search. Used by "grant".
        new_owner_email (Optional[str]): Email of the new owner.
            Required for "transfer_owner".
        move_to_new_owners_root (bool): Move file to the new owner's My Drive root.
            Defaults to False. Used by "transfer_owner".

    Returns:
        str: Confirmation with details of the permission change applied.
manage_eventtool Manages calendar events. Supports creating, updating, deleting, moving, and RSVP.destructive (declared)
Manages calendar events. Supports creating, updating, deleting, moving, and RSVP.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform - "create", "update", "delete", "move", or "rsvp".
        summary (Optional[str]): Event title (required for create).
        start_time (Optional[str]): Start time (required for create). An RFC3339 UTC offset identifies the exact instant and is preserved. Without an offset, supply start_timezone or timezone. For a local wall-clock time, omit the offset and pass the zone so Google resolves daylight saving; a wrong offset moves the event. Date-only values create all-day events.
        end_time (Optional[str]): End time (required for create). An RFC3339 UTC offset identifies the exact instant and is preserved. Without an offset, supply end_timezone or timezone. All-day end dates are exclusive.
        event_id (Optional[str]): Event ID (required for update, delete, move, and rsvp).
        calendar_id (str): Calendar ID (default: 'primary'). For move, this is the source.
        destination_calendar_id (Optional[str]): Calendar to move the event to, which becomes its organizer (required for move). Only default events can be moved, and the user needs access to both calendars.
        description (Optional[str]): Event description.
        location (Optional[str]): Event location.
        attendees (Optional[List[Union[str, Dict[str, Any]]]]): Attendee email addresses, attendee objects (e.g. {"email": ..., "responseStatus": "accepted"}), or a mix of both.
        timezone (Optional[str]): IANA timezone applied to both boundaries (e.g.,
            "America/New_York"). Converts offset-bearing timestamps without changing their
            instant; interprets offset-free timestamps as local times in this zone.
            Overridden per boundary by start_timezone/end_timezone.
        start_timezone (Optional[str]): IANA timezone for the start boundary only,
            overriding timezone. Use for events whose two ends sit in different zones -
            a flight departing 13:45 "Asia/Jerusalem" and landing 17:50
            "Europe/Amsterdam" is one event authored in two zones. Explicit timestamp
            offsets always preserve the instant, even when the zone differs.
        end_timezone (Optional[str]): IANA timezone for the end boundary only,
            overriding timezone. See start_timezone.
        attachments (Optional[List[str]]): List of Google Drive file URLs or IDs to attach.
            On action="update" this replaces the event's existing attachments rather than
            appending to them, matching the Calendar API's patch semantics.
        add_google_meet (Optional[bool]): Whether to add/remove native Google Meet.
        conference_data (Optional[Dict[str, Any]]): Raw Google Calendar `conferenceData`
            payload to attach a third-party conference (Zoom/Webex/Teams add-on). Use this
            for full control; mutually exclusive with the conference_provider helper params
            and with add_google_meet. (create/update only)
        conference_provider (Optional[str]): Higher-level helper: third-party provider name
            (e.g. "zoom", "webex", "teams"). Requires conference_uri. The MCP builds the
            addOn `conferenceData` block internally. (create/update only)
        conference_uri (Optional[str]): Join URL for the third-party conference (e.g.
            "https://zoom.us/j/123456789"). Required when conference_provider is set.
        conference_passcode (Optional[str]): Optional passcode for the third-party conference.
        conference_id (Optional[str]): Optional provider-side conference/meeting ID.
        reminders (Optional[Union[str, List[Dict[str, Any]]]]): Custom reminder objects.
        use_default_reminders (Optional[bool]): Whether to use default reminders.
        transparency (Optional[str]): "opaque" (busy) or "transparent" (free).
        visibility (Optional[str]): "default", "public", "private", or "confidential".
        color_id (Optional[str]): Event color, by name or ID: lavender (1), sage (2),
            grape (3), flamingo (4), banana (5), tangerine (6), peacock (7),
            graphite (8), blueberry (9), basil (10), tomato (11).
        recurrence (Optional[List[str]]): RFC5545 recurrence rules for a recurring event, e.g. ["RRULE:FREQ=WEEKLY;COUNT=10"].
        guests_can_modify (Optional[bool]): Whether attendees can modify.
        guests_can_invite_others (Optional[bool]): Whether attendees can invite others.
        guests_can_see_other_guests (Optional[bool]): Whether attendees can see other guests.
        response (Optional[str]): RSVP response — "accepted", "declined", "tentative", or "needsAction" (rsvp action only).
        rsvp_comment (Optional[str]): Optional message to include with the RSVP response (rsvp action only).
        send_updates (Optional[str]): Notification behavior: "all", "externalOnly", or "none".
            Defaults to "none" for move and "all" for other actions.
        this_and_following (bool): Update only. With event_id set to a recurring instance ID,
            applies the change to that instance and every later one by ending the original
            series before it and starting a new series there; earlier instances are kept.
            Updating the series ID instead changes every instance, and moving its start or
            recurrence drops past instances that no longer match. Defaults to False.

    Returns:
        str: Confirmation message with event details.
manage_focus_timetool Manages Focus Time events on Google Calendar. These special events auto-declinedestructive (declared)
Manages Focus Time events on Google Calendar. These special events auto-decline
    meeting invitations and, by default, set the user's chat status to Do Not
    Disturb, helping protect blocks of uninterrupted work time.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform - "create", "list", "update", or "delete".
        start_time (Optional[str]): Start date/time. Use 'YYYY-MM-DD' for full-day or RFC3339 for partial-day (e.g., '2024-04-05T09:00:00Z'). Date-only values are auto-converted to dateTime (midnight-to-midnight). Required for create.
        end_time (Optional[str]): End date/time (exclusive). Same format as start_time. For a single full day on April 5, use start_time='2026-04-05' and end_time='2026-04-06'. Required for create.
        summary (Optional[str]): Display text on the calendar. Defaults to "Focus Time".
        description (Optional[str]): Event description. Useful for adding context about what the focus time is for.
        auto_decline_mode (Optional[str]): How to handle conflicting invitations. One of: "declineAllConflictingInvitations" (default), "declineOnlyNewConflictingInvitations", "declineNone".
        decline_message (Optional[str]): Message included when auto-declining invitations.
        chat_status (Optional[str]): Google Chat status during the focus time. Supports "doNotDisturb" (default) and "available".
        recurrence (Optional[List[str]]): RFC5545 recurrence rules for a recurring Focus Time series, e.g. ["RRULE:FREQ=WEEKLY;COUNT=10"].
        timezone (Optional[str]): Timezone for the event (e.g., "America/New_York", "Europe/London"). Required when using date-only values or dateTime values without an explicit UTC offset.
        time_min (Optional[str]): For "list" action: start of time range. Defaults to current time. Recurring series are expanded into individual instances in the requested range.
        time_max (Optional[str]): For "list" action: end of time range.
        max_results (int): For "list" action: maximum events to return in one page. Defaults to 10.
        event_id (Optional[str]): Event ID. Required for "update" and "delete" actions.
        calendar_id (str): Calendar ID. Defaults to 'primary'. Focus Time status events live on primary calendars, so use 'primary' or a user's primary calendar ID/email rather than a secondary calendar ID.
        page_token (Optional[str]): For "list" action: token for the next page, taken from a previous response. Also pass the response's Pagination time_min as time_min, even if omitted on the first call. Keep all other query parameters unchanged.

    Returns:
        str: Confirmation message with event details, or a formatted list of Focus Time events.
manage_gmail_filtertool Manages Gmail filters: create, delete, update, and apply to existing mail.destructive (declared)
Manages Gmail filters: create, delete, update, and apply to existing mail.

    - update: Gmail has no filter update API, so the filter is recreated (new
      one first, then the old one is deleted) and its ID changes. A passed
      criteria or filter_action replaces that whole object; omit one to keep
      the old filter's.
    - apply: runs a filter's label actions on mail ALREADY in the mailbox
      (Gmail filters only act on new mail). Only matching messages change,
      not whole conversations as in the web UI. Use filter_id, or criteria +
      filter_action for an ad-hoc run. Forwarding is never applied. Use
      dry_run=true first to see the search query and the match count.
      Needs the gmail.modify scope in addition to gmail.settings.basic.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): "create", "delete", "update" or "apply".
        criteria (Optional[Dict[str, Any]]): Filter criteria object (required for create; optional for update/apply).
        filter_action (Optional[Dict[str, Any]]): Filter action object (required for create; optional for update/apply). Named 'filter_action' to avoid shadowing the 'action' parameter.
        filter_id (Optional[str]): ID of the filter (required for delete and update; optional for apply).
        dry_run (bool): apply only: count matches without changing anything.
        max_messages (int): apply only: safety cap on messages changed (default 5000).

    Returns:
        str: Confirmation message with filter details.
manage_gmail_labeltool Manages Gmail labels: create, update, or delete labels.destructive (declared)
Manages Gmail labels: create, update, or delete labels.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (Literal["create", "update", "delete"]): Action to perform on the label.
        name (Optional[str]): Label name. Required for create, optional for update.
        label_id (Optional[str]): Label ID. Required for update and delete operations.
        label_list_visibility (Optional[Literal["labelShow", "labelShowIfUnread", "labelHide"]]): Whether the label is shown in the label list. Defaults to "labelShow" on create. On update, omitting it keeps the label's current setting.
        message_list_visibility (Optional[Literal["show", "hide"]]): Whether the label's messages are shown in the message list. Defaults to "show" on create. On update, omitting it keeps the label's current setting.
        background_color (Optional[str]): Label background color as a hex string, e.g. "#fb4c2f". Set together with text_color; Gmail requires both. Gmail accepts only its own palette, and an unsupported value is rejected before the request. Colors apply to user labels, not system labels.
        text_color (Optional[str]): Label text color as a hex string, e.g. "#ffffff". Set together with background_color. Same palette. On update, omitting both keeps the label's current color.
        clear_color (bool): On update, remove the label's current color. Cannot be combined with background_color or text_color.

    Returns:
        str: Confirmation message of the label operation.
manage_named_rangetool Manages the lifecycle of named ranges in a Google Sheet: list, create, update, or delete.destructive (declared)
Manages the lifecycle of named ranges in a Google Sheet: list, create, update, or delete.

    Args:
        user_google_email: The user's Google email address. Required.
        spreadsheet_id: The ID of the spreadsheet. Required.
        action: The operation to perform: "list", "create", "update", or "delete". Required.
        name: Name for the named range (required for "create"; optional identifier for "update"/"delete").
        range_name: Target cell or range in A1 notation (e.g., "Sheet1!A1:D10", "A1:B5") (required for "create").
        named_range_id: The ID of the named range (optional identifier for "update"/"delete").
        new_name: New name for the named range (used with action="update").
        new_range: New A1-style range for the named range (used with action="update").

    Returns:
        str: Confirmation message or formatted list of named ranges.
manage_out_of_officetool Manages Out of Office events on Google Calendar. These special events auto-declinedestructive (declared)
Manages Out of Office events on Google Calendar. These special events auto-decline
    meeting invitations and set the user's status to "Out of office" across Google Workspace.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform - "create", "list", "update", or "delete".
        start_time (Optional[str]): Start date/time. Use 'YYYY-MM-DD' for full-day or RFC3339 for partial-day (e.g., '2024-04-05T09:00:00Z'). Date-only values are auto-converted to dateTime (midnight-to-midnight). Required for create.
        end_time (Optional[str]): End date/time (exclusive). Same format as start_time. For a single full day on April 5, use start_time='2026-04-05' and end_time='2026-04-06'. Required for create.
        summary (Optional[str]): Display text on the calendar. Defaults to "Out of Office".
        auto_decline_mode (Optional[str]): How to handle conflicting invitations. One of: "declineAllConflictingInvitations" (default), "declineOnlyNewConflictingInvitations", "declineNone".
        decline_message (Optional[str]): Message included when auto-declining invitations.
        recurrence (Optional[List[str]]): RFC5545 recurrence rules for a recurring Out of Office series, e.g. ["RRULE:FREQ=WEEKLY;COUNT=10"].
        timezone (Optional[str]): Timezone for the event (e.g., "America/New_York", "Europe/London"). Required when using date-only values or dateTime values without an explicit UTC offset.
        time_min (Optional[str]): For "list" action: start of time range. Defaults to current time. Recurring series are expanded into individual instances in the requested range.
        time_max (Optional[str]): For "list" action: end of time range.
        max_results (int): For "list" action: maximum events to return in one page. Defaults to 10.
        event_id (Optional[str]): Event ID. Required for "update" and "delete" actions.
        calendar_id (str): Calendar ID. Defaults to 'primary'. Out of Office status events live on primary calendars, so use 'primary' or a user's primary calendar ID/email rather than a secondary calendar ID.
        page_token (Optional[str]): For "list" action: token for the next page, taken from a previous response. Also pass the response's Pagination time_min as time_min, even if omitted on the first call. Keep all other query parameters unchanged.

    Returns:
        str: Confirmation message with event details, or a formatted list of OOO events.
manage_script_contenttool Update the source files of an Apps Script project.destructive (declared)
Update the source files of an Apps Script project.

    Actions:
        - "update": Create or update files. By default (merge=True) the supplied
          files are overlaid onto the project by (name, type), leaving other
          files untouched. Set merge=False to replace the full project file set;
          any existing file omitted from `files` is permanently deleted.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: "update".
        script_id: The script project ID.
        files: File objects with name, type, and source to create or update
            (required for update).
        merge: When True (default), overlay `files` onto the current project.
            When False, replace the full project file set (update only).

    Returns:
        str: Confirmation with the updated file list.
manage_script_projecttool Create or delete an Apps Script project.destructive (declared)
Create or delete an Apps Script project.

    Actions:
        - "create": Create a project. Requires title; parent_id is optional.
        - "delete": Permanently delete a project. Requires script_id.
manage_script_triggertool List or delete the current user's installable triggers on a script project.destructive (declared)
List or delete the current user's installable triggers on a script project.

    The Apps Script REST API has no triggers resource, so in dev_mode both actions
    provision (or refresh) a small helper file and run it via the Execution
    API - the only way to inspect or change trigger state without opening the
    editor. Neither action is read-only: the helper file may be written into the
    project on first use. To create a trigger, use `generate_trigger_code` to
    produce the setup code, add it with `manage_script_content`, then run it with
    `run_script_function`.

    Actions:
        - "list": List the current user's triggers configured on the project.
        - "delete": Delete triggers matching every supplied selector. trigger_id
          removes one trigger; handler_function alone removes EVERY trigger
          calling that function; both together remove the trigger only if its
          handler also matches. At least one is required; run "list" first to
          find a trigger's unique ID.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: One of "list", "delete".
        script_id: The script project ID.
        trigger_id: Unique ID of a specific trigger to delete (delete only).
        handler_function: Delete all triggers calling this function name
            (delete only).
        dev_mode: Run against the latest saved code (default; project owner
            only) vs. the deployed version. False requires the helper to
            already exist in the deployed version.
        deployment_id: Optional API Executable deployment ID. When omitted, the
            highest versioned API Executable deployment is used.

    Returns:
        str: Formatted list of triggers, or a summary of the trigger(s) deleted.
manage_script_versiontool Create immutable version snapshots of a script project.
Create immutable version snapshots of a script project.

    Versions capture a snapshot of the current script code; once created they
    cannot be modified.

    Actions:
        - "create": Create a new version from the current code. Optional
          description.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: "create".
        script_id: The script project ID.
        description: Optional description for the new version (create only).

    Returns:
        str: Formatted result for the requested action.
manage_sheet_tabtool Manages an existing sheet tab: rename, delete, hide, unhide, reorder, ordestructive (declared)
Manages an existing sheet tab: rename, delete, hide, unhide, reorder, or
    style (tab color and gridlines).

    Use create_sheet to add a tab, and resize_sheet_dimensions for row and column
    level changes. This tool operates on the tab itself.

    Args:
        user_google_email: User's Google email address
        spreadsheet_id: ID of the spreadsheet
        sheet_name: Title of the existing tab to act on
        action: One of "rename", "delete", "hide", "unhide", "reorder", "style"
        new_name: New title, required for action="rename"
        new_index: New zero-based position, required for action="reorder"
        tab_color: For action="style": hex tab color (#RRGGBB), or "none" to
            remove it
        show_gridlines: For action="style": show (True) or hide (False) the
            sheet's gridlines

    Returns:
        str: Confirmation of the change.
manage_tasktool Manage tasks: create, update, delete, or move tasks within task lists.destructive (declared)
Manage tasks: create, update, delete, or move tasks within task lists.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform. Must be one of: "create", "update", "delete", "move".
        task_list_id (str): The ID of the task list. Required for all actions.
        task_id (Optional[str]): The ID of the task. Required for "update", "delete", and "move" actions.
        title (Optional[str]): The title of the task. Required for "create", optional for "update".
        notes (Optional[str]): Notes/description for the task. Used by "create" and "update" actions.
        status (Optional[str]): Task status ("needsAction" or "completed"). Used by "update" action.
        due (Optional[str]): Due date in RFC 3339 format (e.g., "2024-12-31T23:59:59Z"). Used by "create" and "update" actions.
        parent (Optional[str]): Parent task ID (for subtasks). Used by "create" and "move" actions.
        previous (Optional[str]): Previous sibling task ID (for positioning). Used by "create" and "move" actions.
        destination_task_list (Optional[str]): Destination task list ID (for moving between lists). Used by "move" action.

    Returns:
        str: Result of the requested action.
manage_task_listtool Manage task lists: create, update, delete, or clear completed tasks.destructive (declared)
Manage task lists: create, update, delete, or clear completed tasks.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform. Must be one of: "create", "update", "delete", "clear_completed".
        task_list_id (Optional[str]): The ID of the task list. Required for "update", "delete", and "clear_completed" actions.
        title (Optional[str]): The title for the task list. Required for "create" and "update" actions.

    Returns:
        str: Result of the requested action.
modify_doc_texttool Modifies text in a Google Doc - can insert/replace text and/or apply formatting in a single operation.destructive (declared)
Modifies text in a Google Doc - can insert/replace text and/or apply formatting in a single operation.

    TIP: To append text to the end of the document without calculating indices,
    set end_of_segment=true. This avoids index calculation errors.

    HEADING MODE: Pass heading instead of start_index to edit the body below a
    heading, up to the next heading of equal or shallower level. text is
    rendered as Markdown and replaces that body; end_of_segment=true appends
    instead. Formatting parameters without text format the whole body.

    For ordinary header/footer text, prefer update_doc_headers_footers.
    Only pass segment_id when you already have a real header/footer/footnote
    segment ID from inspect_doc_structure output. Do not guess IDs such as
    "kix.header" or "kix.footer".

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        start_index: Start position for operation using Docs API indices from
            inspect_doc_structure. For the main body, 0 is also accepted as an
            alias for the first writable position. Required unless heading is set.
        end_index: End position for text replacement/formatting (if not provided with text, text is inserted)
        text: New text to insert or replace with (optional - can format existing text without changing it).
            Rendered as Markdown when heading is set.
        heading: Text of a body heading (case-insensitive, must match exactly one) whose
            section to edit instead of start_index/end_index
        heading_level: Optional 1-6 heading level to narrow the heading match
        tab_id: Optional document tab ID to target (required with heading when the doc has multiple tabs)
        segment_id: Optional header/footer/footnote segment ID to target
        end_of_segment: Insert text at the end of the targeted segment instead of start_index
        bold: Whether to make text bold (True/False/None to leave unchanged)
        italic: Whether to make text italic (True/False/None to leave unchanged)
        underline: Whether to underline text (True/False/None to leave unchanged)
        strikethrough: Whether to strike through text (True/False/None to leave unchanged)
        font_size: Font size in points
        font_family: Font family name (e.g., "Arial", "Times New Roman")
        font_weight: Font weight (100-900 in steps of 100; requires font_family)
        text_color: Foreground text color (#RRGGBB)
        background_color: Background/highlight color (#RRGGBB)
        link_url: Hyperlink URL (http/https)
        clear_link: Remove hyperlink from the target range
        baseline_offset: One of NONE, SUPERSCRIPT, SUBSCRIPT
        small_caps: Whether to apply small caps

    Returns:
        str: Confirmation message with operation details
modify_gmail_message_labelstool Adds or removes labels from a Gmail message.destructive (declared)
Adds or removes labels from a Gmail message.
    To archive an email, remove the INBOX label.
    To delete an email, add the TRASH label.

    Args:
        user_google_email (str): The user's Google email address. Required.
        message_id (str): The ID of the message to modify.
        add_label_ids (Optional[List[str]]): List of label IDs to add to the message.
        remove_label_ids (Optional[List[str]]): List of label IDs to remove from the message.

    Returns:
        str: Confirmation message of the label changes applied to the message.
modify_sheet_valuestool Modifies values in a specific range of a Google Sheet - can write, update, or clear values,Networkdestructive (declared)
Modifies values in a specific range of a Google Sheet - can write, update, or clear values,
    insert Smart Chips (Drive files/folders or People), or copy another range into it.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        range_name (str): The range to modify (e.g., "Sheet1!A1:D10", "A1:D10"). Required.
        values (Optional[Union[str, List[List[str]]]]): 2D array of values to write/update. Can be a JSON string or Python list. Required unless clear_values=True or chips is provided.
        value_input_option (str): How to interpret input values ("RAW" or "USER_ENTERED"). Defaults to "USER_ENTERED".
        clear_values (bool): If True, clears the range instead of writing values. Defaults to False.
        chips (Optional[Union[str, dict, List[Any]]]): Smart chip(s) to insert instead of values:
            - A single URL or email string for a single cell (e.g., "https://drive.google.com/drive/folders/123", "[email protected]").
            - A list of URLs or emails for a single cell (multiple chips) or across cells (e.g., ["https://...", "https://..."]).
            - A 2D list of URLs/emails matching a grid range. For a single-row or single-column
              range, each inner list is instead the chips for one cell (e.g., [["[email protected]", "[email protected]"]]
              puts both chips in the first cell of "A1:C1").
            - A dict or list of dicts with explicit properties (e.g., {"type": "drive", "uri": "..."}, {"type": "person", "email": "..."}).
            - A JSON-encoded string representing any of the above formats.
        chip_type (Optional[str]): Explicit chip type if passing raw strings in chips: "drive" (default for URLs/IDs) or "person" (default for emails).
        source_range (Optional[str]): A1 range in the same spreadsheet to copy into range_name, like the UI copy and
            paste: relative formula references shift and formatting comes along. Both ranges must be A1 notation (not
            named ranges); one without a sheet name uses the first sheet. range_name may be just the top-left cell
            (e.g., copy "Sheet1!A29:AO29" to "Sheet1!A30"). Use instead of values, chips, or clear_values.
        paste_type (str): What source_range pastes: "PASTE_NORMAL" (values, formulas, formatting), "PASTE_VALUES",
            "PASTE_FORMAT", "PASTE_NO_BORDERS", "PASTE_FORMULA", "PASTE_DATA_VALIDATION", or
            "PASTE_CONDITIONAL_FORMATTING". Defaults to "PASTE_NORMAL".

    Returns:
        str: Confirmation message of the successful modification operation.
move_sheet_rowstool Moves rows from one sheet to another within the same spreadsheet. The movedestructive (declared)
Moves rows from one sheet to another within the same spreadsheet. The move
    is performed in a single batchUpdate (copyPaste followed by
    deleteDimension). Note: batchUpdate executes requests sequentially but does
    not roll back on partial failure — if the copy succeeds but the delete
    fails, rows may be duplicated. Formulas, data types, and formatting are
    preserved (unlike a values.get/append round-trip).
    Row numbers are 1-based (matching the spreadsheet UI).

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        source_sheet (str): Name of the sheet to move rows from. Required.
        start_row (int): First row to move (1-based, inclusive). Required.
        end_row (int): Last row to move (1-based, inclusive). Required.
        destination_sheet (str): Name of the sheet to move rows to. Required.

    Returns:
        str: Confirmation message with the number of rows moved.
query_freebusytool Returns free/busy information for a set of calendars.read-only (declared)
Returns free/busy information for a set of calendars.

    Args:
        user_google_email (str): The user's Google email address. Required.
        time_min (str): The start of the interval for the query in RFC3339 format (e.g., '2024-05-12T10:00:00Z' or '2024-05-12').
        time_max (str): The end of the interval for the query in RFC3339 format (e.g., '2024-05-12T18:00:00Z' or '2024-05-12').
        calendar_ids (Optional[List[str]]): List of calendar identifiers to query. If not provided, queries the primary calendar. Use 'primary' for the user's primary calendar or specific calendar IDs obtained from `list_calendars`.
        group_expansion_max (Optional[int]): Maximum number of calendar identifiers to be provided for a single group. Optional. An error is returned for a group with more members than this value. Maximum value is 100.
        calendar_expansion_max (Optional[int]): Maximum number of calendars for which FreeBusy information is to be provided. Optional. Maximum value is 50.

    Returns:
        str: A formatted response showing free/busy information for each requested calendar, including busy time periods.
read_sheet_valuestool Reads values from a specific range in a Google Sheet, one line per row:FilesNetworkoutside textread-only (declared)
Reads values from a specific range in a Google Sheet, one line per row:
    the sheet row number, then the row's cells separated by tabs.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        range_name (str): The range to read (e.g., "Sheet1!A1:D10", "A1:D10").
            Defaults to "A1:Z1000". Open-ended or oversized ranges are clamped to
            at most 1000 rows before the Sheets API request to bound memory use.
        include_hyperlinks (bool): If True, also fetch hyperlink metadata for the range.
            Defaults to False to avoid expensive includeGridData requests.
        include_notes (bool): If True, also fetch cell notes for the range.
            Defaults to False to avoid expensive includeGridData requests.
        include_formulas (bool): If True, also fetch raw formula strings for cells that
            contain formulas. Useful for identifying cross-sheet references before writing
            back to a range. Defaults to False to avoid an extra API request.
        include_smart_chips (bool): If True, also fetch smart chips metadata (Drive files/folders
            and People chips) for the range. Defaults to False to avoid expensive includeGridData requests.
        include_validation (bool): If True, also fetch data validation rules (dropdowns,
            checkboxes, ranges, custom formulas) for the range. Defaults to False to avoid
            expensive includeGridData requests.

    Returns:
        str: The formatted values, with trailing empty cells dropped.
render_page_to_imagetool Render a slide (or any page, including notes pages) to an image and return it as image content, for looking at a slide's layout and visuals.Networkread-only (declared)
Render a slide (or any page, including notes pages) to an image and return it as image content, for looking at a slide's layout and visuals.

    This is the way to see a slide: use it instead of exporting the
    presentation to PPTX or PDF and rendering that.

    Args:
        user_google_email (str): The user's Google email address. Required.
        presentation_id (str): The ID of the presentation.
        page_object_id (str): The object ID of the page/slide to render.
        size (str): Image width. One of "SMALL" (200px), "MEDIUM" (800px),
            "LARGE" (1600px) or "WIDTH2000_PX" (2000px). Defaults to "MEDIUM".
            Start at MEDIUM: it reads titles and body text. Use LARGE for small
            text such as tables, chart labels and footnotes. WIDTH2000_PX
            rarely reads more than LARGE. SMALL shows layout only; its text is
            unreadable. Token cost and the resolution the model sees depend on
            the model: Claude models with high-resolution vision read MEDIUM at
            ~460 image tokens, LARGE at ~1,850 and WIDTH2000_PX at ~2,900, while
            other models may downscale LARGE and WIDTH2000_PX and count tokens
            differently.

    Returns:
        A short text block (presentation ID, page ID, size and a temporary
        image URL) followed by the rendered PNG as image content. If the image
        cannot be fetched, only the text block is returned, with a note saying
        so.
resize_sheet_dimensionstool Manages sheet-level dimension properties: resize columns/rows, auto-resizedestructive (declared)
Manages sheet-level dimension properties: resize columns/rows, auto-resize
    to fit content, freeze rows/columns, hide/unhide rows/columns, and
    insert/delete rows/columns.

    Every row number and column letter refers to the sheet as it was before
    the call, even when one call both inserts and deletes. Deletes are applied
    before inserts, and an insert position inside a deleted span lands where
    that span was.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        sheet_name (Optional[str]): Sheet name to target. Defaults to the
            first sheet if not provided.
        column_sizes (Optional[Union[str, dict]]): Dict mapping column letters
            to pixel widths. Example: {"A": 200, "C": 300}. Can be a JSON
            string or Python dict.
        row_sizes (Optional[Union[str, dict]]): Dict mapping 1-based row
            numbers to pixel heights. Example: {"1": 40, "3": 60}. Can be
            a JSON string or Python dict.
        auto_resize_columns (Optional[Union[str, List[str]]]): List of column
            letters to auto-resize to fit content. Example: ["A", "B"].
        auto_resize_rows (Optional[Union[str, List[int]]]): List of 1-based
            row numbers to auto-resize to fit content. Example: [1, 2].
        frozen_row_count (Optional[int]): Number of rows to freeze from the
            top. Use 0 to unfreeze all rows.
        frozen_column_count (Optional[int]): Number of columns to freeze from
            the left. Use 0 to unfreeze all columns.
        hide_columns (Optional[Union[str, List[str]]]): List of column letters
            to hide. Example: ["C", "D"].
        unhide_columns (Optional[Union[str, List[str]]]): List of column
            letters to unhide. Example: ["C", "D"].
        hide_rows (Optional[Union[str, List[int]]]): List of 1-based row
            numbers to hide. Example: [3, 4].
        unhide_rows (Optional[Union[str, List[int]]]): List of 1-based row
            numbers to unhide. Example: [3, 4].
        insert_rows (Optional[int]): Number of rows to insert.
        insert_rows_at (Optional[int]): 1-based row number to insert before.
            Appends to the end of the sheet if omitted.
        insert_columns (Optional[int]): Number of columns to insert.
        insert_columns_at (Optional[str]): Column letter to insert before
            (e.g. "C"). Appends to the end if omitted.
        delete_rows (Optional[Union[str, List[int]]]): List of 1-based row
            numbers to delete. Example: [5, 6]. Best for non-contiguous rows.
        delete_row_range (Optional[str]): Contiguous range of rows to delete,
            as "start:end" (1-based, inclusive). Example: "5:10" deletes rows
            5 through 10. More efficient than delete_rows for large contiguous
            ranges.
        delete_columns (Optional[Union[str, List[str]]]): List of column
            letters to delete. Example: ["E", "F"].

    Returns:
        str: Confirmation of the applied dimension changes.
run_script_functiontool Executes a function in a deployed script.destructive (declared)
Executes a function in a deployed script.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        script_id: The script project ID
        function_name: Name of function to execute
        parameters: Optional list of parameters to pass
        dev_mode: Whether to run latest code vs deployed version
        deployment_id: Optional API Executable deployment ID. When supplied,
            skips the automatic deployment lookup. When omitted, the versioned
            API Executable deployment with the highest version number is used.

    Returns:
        str: Formatted string with execution result or error
search_contactstool Search contacts by name, email, phone number, or other fields.read-only (declared)
Search contacts by name, email, phone number, or other fields.

    Args:
        user_google_email (str): The user's Google email address. Required.
        query (str): Search query string (searches names, emails, phone numbers).
        page_size (int): Maximum number of results to return (default: 30, max: 30).

    Returns:
        str: Matching contacts with their basic information.
search_customtool Performs a search using Google Custom Search JSON API.CredentialsEnv varsSensitive pathsread-only (declared)
Performs a search using Google Custom Search JSON API.

    Args:
        user_google_email (str): The user's Google email address. Required.
        q (str): The search query. Required.
        num (int): Number of results to return (1-10). Defaults to 10.
        start (int): The index of the first result to return (1-based). Defaults to 1.
        safe (Literal["active", "moderate", "off"]): Safe search level. Defaults to "off".
        search_type (Optional[Literal["image"]]): Search for images if set to "image".
        site_search (Optional[str]): Restrict search to a specific site/domain.
        site_search_filter (Optional[Literal["e", "i"]]): Exclude ("e") or include ("i") site_search results.
        date_restrict (Optional[str]): Restrict results by date (e.g., "d5" for past 5 days, "m3" for past 3 months).
        file_type (Optional[str]): Filter by file type (e.g., "pdf", "doc").
        language (Optional[str]): Language code for results (e.g., "lang_en").
        country (Optional[str]): Country code for results (e.g., "countryUS").
        sites (Optional[List[str]]): List of sites/domains to restrict search to (e.g., ["example.com", "docs.example.com"]). When provided, results are limited to these sites.

    Returns:
        str: Formatted search results including title, link, and snippet for each result.
search_docstool Searches for Google Docs by name using Drive API (mimeType filter).read-only (declared)
Searches for Google Docs by name using Drive API (mimeType filter).

    Args:
        user_google_email: The user's Google email address.
        query: Text to search for in document names.
        page_size: Maximum number of documents to return. Defaults to 10.
        page_token: Page token from a previous response's nextPageToken to
            retrieve the next page of results.
        corpora: Corpus to search ('user', 'domain', 'drive', 'allDrives').
            Defaults to 'drive' when drive_id is set, otherwise 'allDrives'.
        drive_id: Optional shared drive ID to search.

    Returns:
        str: A formatted list of Google Docs matching the search query.
            Includes a nextPageToken line when more results are available.
search_drive_filestool Searches for files and folders within a user's Google Drive, including shared drives.read-only (declared)
Searches for files and folders within a user's Google Drive, including shared drives.

    Args:
        user_google_email (str): The user's Google email address. Required.
        query (str): The search query string. Supports Google Drive search operators.
                     NOTE: Owner-based queries ('[email protected]' in owners) DO NOT WORK in Shared Drives
                     because files are owned by the shared drive itself, not individual users.
                     For recent files by a specific user in Shared Drives, search by modifiedTime
                     and use order_by='modifiedTime desc' instead.
        page_size (int): The maximum number of files to return. Defaults to 10.
        page_token (Optional[str]): Page token from a previous response's nextPageToken to retrieve the next page of results.
        drive_id (Optional[str]): ID of the shared drive to search. If None, behavior depends on `corpora` and `include_items_from_all_drives`.
        include_items_from_all_drives (bool): Whether shared drive items should be included in results. Defaults to True. This is effective when not specifying a `drive_id`.
        corpora (Optional[str]): Bodies of items to query (e.g., 'user', 'domain', 'drive', 'allDrives').
                                 If 'drive_id' is specified and 'corpora' is None, it defaults to 'drive'.
                                 Otherwise it defaults to 'allDrives' when `include_items_from_all_drives` is True.
                                 Pass 'user' to search only My Drive and files shared with the user.
        file_type (Optional[str]): Restrict results to a specific file type. Accepts a friendly
                                   name ('folder', 'document'/'doc', 'spreadsheet'/'sheet',
                                   'presentation'/'slides', 'form', 'drawing', 'pdf', 'shortcut',
                                   'script', 'site', 'jam'/'jamboard') or any raw MIME type
                                   string (e.g. 'application/pdf'). Defaults to None (all types).
        detailed (bool): Whether to include size, modified time, and link in results. Defaults to True.
        order_by (Optional[str]): Sort order. Comma-separated list of sort keys with optional 'desc' modifier.
                                  Valid keys: 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime',
                                  'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime',
                                  'starred', 'viewedByMeTime'. Example: 'modifiedTime desc' or 'folder,modifiedTime desc,name'.
                                  Defaults to None (Drive API default ordering).
        include_trashed (bool): Whether to include files in the trash. Defaults to False, matching
                                the Drive web UI and `list_drive_items`. Ignored when `query` already
                                contains its own `trashed` clause (`=` or `!=`), which always wins.

    Returns:
        str: A formatted list of found files/folders with their details (ID, name, type, and optionally size, modified time, link).
             Includes a nextPageToken line when more results are available.
search_gmail_messagestool Searches messages in a user's Gmail account based on a query.Networkread-only (declared)
Searches messages in a user's Gmail account based on a query.
    Returns both Message IDs and Thread IDs for each found message, along with Gmail web interface links for manual verification.
    Supports pagination via page_token parameter.

    Args:
        query (str): The search query. Supports standard Gmail search operators.
            Results include drafts unless the query excludes them (e.g. in:sent or -in:drafts).
        user_google_email (str): The user's Google email address. Required.
        page_size (int): The maximum number of messages to return. Defaults to 10.
        page_token (Optional[str]): Token for retrieving the next page of results. Use the next_page_token from a previous response.
        include_headers (bool): If True, also fetch each message's metadata and include
            Subject, From, Date and label IDs (e.g. DRAFT, SENT) per result. Costs one
            metadata get per result, grouped into HTTP batches of up to 10, plus retries
            for transient failures.
            Defaults to False (output unchanged from prior versions).

    Returns:
        str: LLM-friendly structured results with Message IDs, Thread IDs, and clickable Gmail web interface URLs for each found message.
        With include_headers=True, each result also includes Subject, From, Date and Labels.
        Includes pagination token if more results are available.
search_messagestool Searches for messages in Google Chat spaces by text content and/or time range.Networkread-only (declared)
Searches for messages in Google Chat spaces by text content and/or time range.

    Args:
        query: Optional text to search for. If omitted, only time_filter is applied.
        space_id: Optional space to restrict the search to.
        page_size: Maximum number of messages to return per space.
        time_filter: Optional filter using Chat API createTime syntax.
                     Examples:
                       'createTime > "2026-03-18T00:00:00-03:00"'
                       'createTime > "2026-03-18T00:00:00-03:00" AND createTime < "2026-03-19T00:00:00-03:00"'
        max_spaces: Maximum number of spaces to search when space_id is not provided (default 10).

    Returns:
        str: A formatted list of messages matching the search criteria.
send_gmail_messagetool Sends an email using the user's Gmail account. Supports new emails, replies, andFilesNetworkCredentialsEnv varsSensitive pathsoutside textdestructive (declared)
Sends an email using the user's Gmail account. Supports new emails, replies, and
    forwards, with optional attachments. Supports Gmail's "Send As" feature to send
    from configured alias addresses.

    To forward an existing message, pass forward_message_id. The original subject,
    body (quoted with a "Forwarded message" header), and attachments are carried over.
    In forward mode, body (if any) is prepended as a note and subject is optional.
    Threading, reply, and signature options do not apply when forwarding.

    THIS TOOL SENDS IMMEDIATELY AND CANNOT SCHEDULE. Gmail's REST API exposes no
    send-time parameter; Schedule send is a web-UI feature with no API equivalent,
    so no argument to this tool can defer delivery. Never tell a user a message
    was scheduled. For "prepare now, deliver later", create a draft with
    draft_gmail_message. An external scheduler must retain the message data to
    create and send a new message via send_gmail_message at the chosen time, or
    call users.drafts.send with the draft ID returned by draft_gmail_message.
    Alternatively, let the user schedule that draft in the Gmail UI.

    Args:
        to (str): Recipient email address.
        subject (str): Email subject. Required for a new message. Optional when replying
            with thread_id (inherits the parent message's subject) or forwarding (then
            defaults to 'Fwd: <original subject>').
        body (str): Email body content. Required unless forwarding (then an optional prepended note).
        body_format (Literal['plain', 'html']): Body format (and prepended note format when forwarding). Defaults to 'plain'.
        forward_message_id (Optional[str]): Gmail message ID to forward. When set, the tool forwards that message.
        include_forwarded_attachments (bool): Whether to carry over the original attachments when forwarding. Defaults to True.
        attachments (Optional[List[Dict[str, str]]]): Optional list of attachments. Each dict can contain:
            Option 1 - File path (auto-encodes):
              - 'path' (required): File path to attach
              - 'filename' (optional): Override filename
              - 'mime_type' (optional): Override MIME type (auto-detected if not provided)
            Option 2 - Base64 content:
              - 'content' (required): Standard base64-encoded file content (not urlsafe)
              - 'filename' (required): Name of the file
              - 'mime_type' (optional): MIME type (defaults to 'application/octet-stream')
        cc (Optional[str]): Optional CC email address.
        bcc (Optional[str]): Optional BCC email address.
        from_name (Optional[str]): Optional sender display name. If provided, the From header will be formatted as 'Name <email>'.
        from_email (Optional[str]): Optional 'Send As' alias email address. The alias must be
            configured in Gmail settings (Settings > Accounts > Send mail as). If not provided,
            the email will be sent from the authenticated user's primary email address.
        user_google_email (str): The user's Google email address. Required for authentication.
        thread_id (Optional[str]): Optional Gmail thread ID to reply within. When
            in_reply_to is omitted, replies to the latest non-draft, non-trash message
            with an RFC Message-ID.
        in_reply_to (Optional[str]): Optional RFC Message-ID to explicitly reply to
            a specific message. Omit to reply to the latest eligible message.
        references (Optional[str]): Optional RFC Message-ID ancestry chain. Normally
            omit when thread_id is provided; the chain is derived automatically.
        include_signature (bool): Whether to append Gmail signature HTML from send-as settings.
            When include_signature is true and Gmail signature retrieval fails for benign reasons
            (e.g., missing gmail.settings.basic scope), the send proceeds without a signature.
            Non-benign failures such as quota/rate-limit or API errors raise ToolError and abort
            the send.
        quote_original (bool): Whether to append the message being replied to as a quoted
            original. Only has an effect when thread_id is provided.
        reply_all (bool): Whether to derive reply-all recipients from the thread: To = the
            sender being replied to, Cc = the other participants, excluding the authenticated
            account and from_email. Requires thread_id. Explicit to/cc win over the derived
            values; when cc is omitted, the sender being replied to is added to the derived Cc
            unless they are already in To (so an explicit 'to' that redirects the reply still
            keeps them on it).
        priority (str): 'high' or 'low' adds priority headers. Defaults to 'normal'.

    Returns:
        str: Confirmation message with the sent email's message ID.

    Examples:
        # Send a new email
        send_gmail_message(to="[email protected]", subject="Hello", body="Hi there!")

        # Send with a custom display name
        send_gmail_message(to="[email protected]", subject="Hello", body="Hi there!", from_name="John Doe")

        # Send an HTML email
        send_gmail_message(
            to="[email protected]",
            subject="Hello",
            body="<strong>Hi there!</strong>",
            body_format="html"
        )

        # Send from a configured alias (Send As)
        send_gmail_message(
            to="[email protected]",
            subject="Business Inquiry",
            body="Hello from my business address...",
            from_email="[email protected]"
        )

        # Send an email with CC and BCC
        send_gmail_message(
            to="[email protected]",
            cc="[email protected]",
            bcc="[email protected]",
            subject="Project Update",
            body="Here's the latest update..."
        )

        # Send an email with attachments (using file path)
        send_gmail_message(
            to="[email protected]",
            subject="Report",
            body="Please see attached report.",
            attachments=[{
                "path": "/path/to/report.pdf"
            }]
        )

        # Send an email with attachments (using base64 content)
        send_gmail_message(
            to="[email protected]",
            subject="Report",
            body="Please see attached report.",
            attachments=[{
                "filename": "report.pdf",
                "content": "JVBERi0xLjQK...",  # base64 encoded PDF
                "mime_type": "application/pdf"
            }]
        )

        # Send a reply
        send_gmail_message(
            to="[email protected]",
            subject="Re: Meeting tomorrow",
            body="Thanks for the update!",
            thread_id="thread_123"
        )

        # Send a reply-all with the original quoted, deriving headers and
        # recipients from the thread
        send_gmail_message(
            subject="Re: Meeting tomorrow",
            body="Thanks for the update!",
            thread_id="thread_123",
            reply_all=True,
            quote_original=True
        )

        # Forward a message with a note
        send_gmail_message(
            to="[email protected]",
            forward_message_id="abc123",
            body="FYI - see below."
        )

        # Forward without the original attachments
        send_gmail_message(
            to="[email protected]",
            forward_message_id="abc123",
            include_forwarded_attachments=False
        )
send_messagetool Sends a message to a Google Chat space, or edits a message already sent there.destructive (declared)
Sends a message to a Google Chat space, or edits a message already sent there.

    Args:
        thread_name: Reply in an existing thread by its resource name (e.g. spaces/X/threads/Y).
        thread_key: Reply in a thread by app-defined key (creates thread if not found).
        message_name: Edit this message in place instead of sending a new one
            (e.g. spaces/X/messages/Y, as returned by send_message or get_messages).
            Must be a message of space_id. Only the text is replaced, and only the
            author can edit their own message.

    Returns:
        str: Confirmation message with the sent or updated message details.
set_drive_file_permissionstool Sets file-level sharing settings and controls link sharing for a Google Drive file or folder.destructive (declared)
Sets file-level sharing settings and controls link sharing for a Google Drive file or folder.

    This is a high-level tool for the most common permission changes. Use this to toggle
    "anyone with the link" access or configure file-level sharing behavior. For managing
    individual user/group permissions, use share_drive_file or update_drive_permission instead.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file or folder. Required.
        link_sharing (Optional[str]): Control "anyone with the link" access for the file.
            - "off": Disable "anyone with the link" access for this file.
            - "reader": Anyone with the link can view.
            - "commenter": Anyone with the link can comment.
            - "writer": Anyone with the link can edit.
        writers_can_share (Optional[bool]): Whether editors can change permissions and share.
            If False, only the owner can share. Defaults to None (no change).
        copy_requires_writer_permission (Optional[bool]): Whether viewers and commenters
            are prevented from copying, printing, or downloading. Defaults to None (no change).

    Returns:
        str: Summary of all permission changes applied to the file.
set_publish_settingstool Updates the publish settings of a form.
Updates the publish settings of a form.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form to update publish settings for.
        is_published (bool): Whether the form is published and visible to responders. Defaults to True.
        is_accepting_responses (bool): Whether the form accepts responses. Only takes effect when the form is published. Defaults to True.

    Returns:
        str: Confirmation message of the successful publish settings update.
start_google_authtool Manually initiate Google OAuth authentication flow.FilesCredentialsEnv varsSensitive pathsoutside text
Manually initiate Google OAuth authentication flow.

    NOTE: This is a legacy OAuth 2.0 tool and is disabled when OAuth 2.1 is enabled.
    The authentication system automatically handles credential checks and prompts for
    authentication when needed. Only use this tool if:
    1. You need to re-authenticate with different credentials
    2. You want to proactively authenticate before using other tools
    3. The automatic authentication flow failed and you need to retry

    In most cases, simply try calling the Google Workspace tool you need - it will
    automatically handle authentication if required.
update_doc_headers_footerstool Safely creates or updates header/footer text in a Google Doc.destructive (declared)
Safely creates or updates header/footer text in a Google Doc.

    This is the default tool for header/footer content. Do NOT use
    batch_update_doc with create_header_footer just to set header/footer text;
    that low-level operation is only for advanced section-break workflows and
    can fail when the default header/footer already exists.

    This tool handles both creation and update in one call:
    - If the header/footer does not exist, it is automatically created first.
    - If the header/footer already exists, its content is replaced.

    You do NOT need to create a header/footer separately before calling this tool.
    Simply call it with the desired content and it will work whether the
    header/footer exists or not.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        section_type: Type of section to create or update ("header" or "footer")
        content: Text content for the header/footer
        header_footer_type: Type of header/footer ("DEFAULT", "FIRST_PAGE_ONLY", "EVEN_PAGE")

    Returns:
        str: Confirmation message with update details
update_drive_filetool Updates metadata, properties, and/or content of a Google Drive file.FilesCredentialsEnv varsSensitive pathsoutside textdestructive (declared)
Updates metadata, properties, and/or content of a Google Drive file.

    Providing new content (inline as ``content``, fetched from ``file_url``, or on a
    local server read from a file path) replaces the file's content in place,
    preserving the existing file ID, sharing, comments, and links.
    For native Google Docs/Sheets/Slides the source is uploaded with its source MIME
    type so the Drive API applies the same format conversion as import_to_google_doc
    (markdown headings, tables, bold, etc.). For any other file (.md, .txt, .pdf, ...)
    there is nothing to convert, so the bytes are written back as-is under the file's
    own MIME type. Metadata and content can be updated in a single call.

    ``mode='append'``/``'prepend'`` splice ``content`` onto the file's existing text
    server-side, so only the new text has to be supplied — no need to send the whole
    file back to rewrite it.

    Drive shortcuts are handled according to the kind of update: supported
    resource-local metadata changes (rename, move, trash, star, description, and
    custom properties) apply to the supplied shortcut, while content replacement
    follows the shortcut and updates its target. To avoid applying metadata to the
    wrong resource, a shortcut call cannot combine content with resource-local
    metadata. Update the shortcut metadata and target content in separate calls.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file to update. Required.
        name (Optional[str]): New name for the file.
        description (Optional[str]): New description for the file.
        mime_type (Optional[str]): New MIME type (note: changing type may require
            content upload). For a shortcut ID, this must accompany content and applies
            to the resolved target.
        add_parents (Optional[str]): Comma-separated folder IDs to add as parents.
        remove_parents (Optional[str]): Comma-separated folder IDs to remove from parents.
        starred (Optional[bool]): Whether to star/unstar the file.
        trashed (Optional[bool]): Whether to move file to/from trash.
        writers_can_share (Optional[bool]): Whether editors can share the file. Pass the
            target ID directly; this cannot be changed on a shortcut resource.
        copy_requires_writer_permission (Optional[bool]): Whether copying requires writer
            permission. Pass the target ID directly; this cannot be changed on a
            shortcut resource.
        properties (Optional[dict]): Custom key-value properties for the file.
        content (Optional[str]): New text content for text-based formats (markdown, TXT, HTML).
        file_path (Optional[str]): Local file path for binary formats (DOCX, ODT). Supports file:// URLs.
        file_url (Optional[str]): Remote http(s) URL to fetch new content from.
        source_format (Optional[str]): Source format hint for conversion
            (md, markdown, docx, txt, html, rtf, odt). Auto-detected when omitted, and
            ignored for non-Google files, which are uploaded without conversion.
            Provide at most one content source.
        mode (str): How to apply the new content — 'replace' (default), 'append', or
            'prepend'. Append/prepend require 'content' and a UTF-8 text file such as
            .md or .txt; a newline is inserted at the seam if neither side has one.
            For native Google Docs use insert_doc_elements, modify_doc_text, or
            find_and_replace_doc, which edit in place instead of rewriting the file.
        return_upload_url (bool): Return a Google resumable-upload session URL to
            PUT the replacement bytes to directly (no Authorization header); any
            metadata changes take effect with the upload. Only with
            mode='replace'; not combinable with another content source. Here
            mime_type names the MIME type of the bytes to be uploaded; on a native
            Google file it is required, names only that, and leaves the file's type
            untouched. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with details of the updates applied, or the
            resumable upload URL.
update_paragraph_styletool Apply paragraph-level formatting, heading styles, and/or list formatting to a range in a Google Doc.
Apply paragraph-level formatting, heading styles, and/or list formatting to a range in a Google Doc.

    This tool can apply named heading styles (H1-H6) for semantic document structure,
    create bulleted or numbered lists with nested indentation, and customize paragraph
    properties like alignment, spacing, and indentation. All operations can be applied
    in a single call.

    Args:
        user_google_email: User's Google email address
        document_id: Document ID to modify
        start_index: Start position using Docs API indices from
            inspect_doc_structure. For the main body, 0 is also accepted as an
            alias for the first writable position.
        end_index: End position (exclusive) - should cover the entire paragraph
        heading_level: Heading level 0-6 (0 = NORMAL_TEXT, 1 = H1, 2 = H2, etc.)
                       Use for semantic document structure
        alignment: Text alignment - 'START' (left), 'CENTER', 'END' (right), or 'JUSTIFIED'
        line_spacing: Line spacing multiplier (1.0 = single, 1.5 = 1.5x, 2.0 = double)
        indent_first_line: First line indent in points (e.g., 36 for 0.5 inch)
        indent_start: Left/start indent in points
        indent_end: Right/end indent in points
        space_above: Space above paragraph in points (e.g., 12 for one line)
        space_below: Space below paragraph in points
        named_style_type: Direct named style type - 'NORMAL_TEXT', 'TITLE', 'SUBTITLE',
                         'HEADING_1' through 'HEADING_6'. Mutually exclusive with heading_level.
        tab_id: Optional document tab ID to target
        segment_id: Optional header/footer/footnote segment ID to target
        direction: Paragraph direction - 'LEFT_TO_RIGHT' or 'RIGHT_TO_LEFT'
        keep_lines_together: Keep all lines of the paragraph together
        keep_with_next: Keep the paragraph with the next paragraph
        avoid_widow_and_orphan: Avoid widows/orphans for the paragraph
        page_break_before: Start the paragraph on a new page
        spacing_mode: 'NEVER_COLLAPSE' or 'COLLAPSE_LISTS'
        shading_color: Paragraph shading/background color (#RRGGBB)
        border_edges: Paragraph border edges to update ('top', 'bottom', 'left',
                      'right', or 'between'); omit to update all four outer edges
        border_color: Border color (#RRGGBB; defaults to black)
        border_width: Border width in points (defaults to 1)
        border_padding: Border padding in points (defaults to 4)
        border_dash: Border dash style ('SOLID', 'DOT', or 'DASH'; defaults to 'SOLID')
        list_type: Create a list from existing paragraphs ('UNORDERED' for bullets, 'ORDERED' for numbers, 'CHECKBOX' for checklists), or 'NONE' to remove existing list formatting from the range. Use 'NONE' when text inserted after a list has inherited its bullets: setting named_style_type or heading_level does not clear list membership, only 'NONE' does.
        list_nesting_level: Nesting level for lists (0-8, where 0 is top level, default is 0)
                           Use higher levels for nested/indented list items
        bullet_preset: Optional explicit Google Docs bullet preset

    Returns:
        str: Confirmation message with formatting details

    Examples:
        # Apply H1 heading style
        update_paragraph_style(document_id="...", start_index=1, end_index=20, heading_level=1)

        # Create a bulleted list
        update_paragraph_style(document_id="...", start_index=1, end_index=50,
                               list_type="UNORDERED")

        # Create a nested numbered list item
        update_paragraph_style(document_id="...", start_index=1, end_index=30,
                               list_type="ORDERED", list_nesting_level=1)

        # Apply H2 heading with custom spacing
        update_paragraph_style(document_id="...", start_index=1, end_index=30,
                               heading_level=2, space_above=18, space_below=12)

        # Center-align a paragraph with double spacing
        update_paragraph_style(document_id="...", start_index=1, end_index=50,
                               alignment="CENTER", line_spacing=2.0)

Text the model reads (120)

Every tool, prompt and resource description as written in the code: the model sees all of it, the user usually does not.

list_comments tool
manage_comment tool
start_google_auth tool
Manually initiate Google OAuth authentication flow.

    NOTE: This is a legacy OAuth 2.0 tool and is disabled when OAuth 2.1 is enabled.
    The authentication system automatically handles credential checks and prompts for
    authentication when needed. Only use this tool if:
    1. You need to re-authenticate with different credentials
    2. You want to proactively authenticate before using other tools
    3. The automatic authentication flow failed and you need to retry

    In most cases, simply try calling the Google Workspace tool you need - it will
    automatically handle authentication if required.
func tool
get_script_project tool
Read Apps Script projects and their source files.

    Actions:
        - "list": List Apps Script projects accessible to the user (Drive-backed).
          Optional: page_size, page_token.
        - "get": Retrieve one project's metadata and file overview, or one
          complete source file when file_name is provided. Requires script_id.

    Args:
        drive_service: Injected Drive client (used for list).
        script_service: Injected Script client (used for get).
        user_google_email: User's email address
        action: One of "list", "get".
        script_id: The script project ID (required for get).
        file_name: Optional source file name for get.
        page_size: Number of results per page for list (default: 50).
        page_token: Pagination token for list (optional).

    Returns:
        str: Formatted result for the requested action.
manage_script_content tool
Update the source files of an Apps Script project.

    Actions:
        - "update": Create or update files. By default (merge=True) the supplied
          files are overlaid onto the project by (name, type), leaving other
          files untouched. Set merge=False to replace the full project file set;
          any existing file omitted from `files` is permanently deleted.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: "update".
        script_id: The script project ID.
        files: File objects with name, type, and source to create or update
            (required for update).
        merge: When True (default), overlay `files` onto the current project.
            When False, replace the full project file set (update only).

    Returns:
        str: Confirmation with the updated file list.
run_script_function tool
Executes a function in a deployed script.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        script_id: The script project ID
        function_name: Name of function to execute
        parameters: Optional list of parameters to pass
        dev_mode: Whether to run latest code vs deployed version
        deployment_id: Optional API Executable deployment ID. When supplied,
            skips the automatic deployment lookup. When omitted, the versioned
            API Executable deployment with the highest version number is used.

    Returns:
        str: Formatted string with execution result or error
manage_deployment tool
Create, update, or delete Apps Script deployments.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: Action to perform - "create", "update", or "delete"
        script_id: The script project ID
        deployment_id: The deployment ID (required for update and delete)
        description: Deployment description (required for create; optional for update
            when version_number is supplied)
        version_description: Optional version description (for create only)
        version_number: Version number to point the deployment at (for update only).
            Required to roll a deployment forward to a newly created script version.

    Returns:
        str: Formatted string with deployment details or confirmation
list_script_deployments tool
List deployments for an Apps Script project.
manage_script_project tool
Create or delete an Apps Script project.

    Actions:
        - "create": Create a project. Requires title; parent_id is optional.
        - "delete": Permanently delete a project. Requires script_id.
manage_script_version tool
Create immutable version snapshots of a script project.

    Versions capture a snapshot of the current script code; once created they
    cannot be modified.

    Actions:
        - "create": Create a new version from the current code. Optional
          description.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: "create".
        script_id: The script project ID.
        description: Optional description for the new version (create only).

    Returns:
        str: Formatted result for the requested action.
get_script_version tool
List or retrieve immutable version snapshots of a script project.

    Actions:
        - "list": List every version of the project.
        - "get": Retrieve one version. Requires version_number.
get_script_activity tool
Read execution activity for scripts: recent processes or aggregate metrics.

    Actions:
        - "processes": List recent execution processes. Without script_id, lists
          the user's own recent runs; with script_id, lists all processes for
          that script visible to the user (including runs by others). Optional
          page_size.
        - "metrics": Get aggregate execution metrics (active users, total and
          failed executions) for one script. Requires script_id; optional
          metrics_granularity ("DAILY" or "WEEKLY").

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: One of "processes", "metrics".
        script_id: The script project ID (required for metrics; optional for
            processes).
        page_size: Number of results for processes (default: 50).
        metrics_granularity: Granularity for metrics - "DAILY" or "WEEKLY".

    Returns:
        str: Formatted process list or metrics data.
generate_trigger_code tool
Generates Apps Script code for creating triggers.

    The Apps Script API cannot create triggers directly - they must be created
    from within Apps Script itself. This tool generates the code you need.
    To list or remove existing triggers without opening the editor, use
    `manage_script_trigger` (action="list" / action="delete") instead.

    Args:
        trigger_type: Type of trigger. One of:
                      - "time_minutes" (run every N minutes: 1, 5, 10, 15, 30)
                      - "time_hours" (run every N hours: 1, 2, 4, 6, 8, 12)
                      - "time_daily" (run daily at a specific hour: 0-23)
                      - "time_weekly" (run weekly on a specific day)
                      - "on_open" (simple trigger - runs when document opens)
                      - "on_edit" (simple trigger - runs when user edits)
                      - "on_form_submit" (runs when form is submitted)
                      - "on_change" (runs when content changes)

        function_name: The function to run when trigger fires (e.g., "sendDailyReport")

        schedule: Schedule details (depends on trigger_type):
                  - For time_minutes: "1", "5", "10", "15", or "30"
                  - For time_hours: "1", "2", "4", "6", "8", or "12"
                  - For time_daily: hour as "0"-"23" (e.g., "9" for 9am)
                  - For time_weekly: "MONDAY", "TUESDAY", etc.
                  - For simple triggers (on_open, on_edit): not needed

    Returns:
        str: Apps Script code to create the trigger
manage_script_trigger tool
List or delete the current user's installable triggers on a script project.

    The Apps Script REST API has no triggers resource, so in dev_mode both actions
    provision (or refresh) a small helper file and run it via the Execution
    API - the only way to inspect or change trigger state without opening the
    editor. Neither action is read-only: the helper file may be written into the
    project on first use. To create a trigger, use `generate_trigger_code` to
    produce the setup code, add it with `manage_script_content`, then run it with
    `run_script_function`.

    Actions:
        - "list": List the current user's triggers configured on the project.
        - "delete": Delete triggers matching every supplied selector. trigger_id
          removes one trigger; handler_function alone removes EVERY trigger
          calling that function; both together remove the trigger only if its
          handler also matches. At least one is required; run "list" first to
          find a trigger's unique ID.

    Args:
        service: Injected Google API service client
        user_google_email: User's email address
        action: One of "list", "delete".
        script_id: The script project ID.
        trigger_id: Unique ID of a specific trigger to delete (delete only).
        handler_function: Delete all triggers calling this function name
            (delete only).
        dev_mode: Run against the latest saved code (default; project owner
            only) vs. the deployed version. False requires the helper to
            already exist in the deployed version.
        deployment_id: Optional API Executable deployment ID. When omitted, the
            highest versioned API Executable deployment is used.

    Returns:
        str: Formatted list of triggers, or a summary of the trigger(s) deleted.
list_calendars tool
Retrieves a list of calendars accessible to the authenticated user.

    Args:
        user_google_email (str): The user's Google email address. Required.
        max_results (Optional[int]): Maximum calendars to return in one page. Omit to use the API default.
        page_token (Optional[str]): Token for the next page, taken from a previous response.

    Returns:
        str: A formatted list of the user's calendars (summary, ID, primary status, time zone).
            When more calendars remain, a "Next page token" line is appended.
get_events tool
Retrieves events from a specified Google Calendar. Can retrieve a single event by ID or multiple events within a time range.
    You can also search for events by keyword by supplying the optional "query" param.

    Args:
        user_google_email (str): The user's Google email address. Required.
        calendar_id (str): The ID of the calendar to query. Use 'primary' for the user's primary calendar. Defaults to 'primary'. Calendar IDs can be obtained using `list_calendars`.
        event_id (Optional[str]): The ID of a specific event to retrieve. If provided, retrieves only this event and ignores time filtering parameters.
        time_min (Optional[str]): The start of the time range (inclusive) in RFC3339 format (e.g., '2024-05-12T10:00:00Z' or '2024-05-12'). If omitted, defaults to the current time when single_events=True. It is omitted from unexpanded queries so recurring masters that began in the past but still have future occurrences remain discoverable. Ignored if event_id is provided.
        time_max (Optional[str]): The end of the time range (exclusive) in RFC3339 format. If omitted, events starting from `time_min` onwards are considered (up to `max_results`). Ignored if event_id is provided.
        max_results (int): The maximum number of events to return in one page. Defaults to 25. Ignored if event_id is provided.
        page_token (Optional[str]): Token for the next page, taken from a previous response. When single_events=True, also pass the response's Pagination time_min as time_min, even if omitted on the first call. Keep all other query parameters unchanged. Ignored if event_id is provided.
        query (Optional[str]): A keyword to search for within event fields (summary, description, location). Ignored if event_id is provided.
        detailed (bool): Whether to return detailed event information including description, location, colour (colorId), attendees, and attendee details (response status, organizer, optional flags). Recurring instances also report the parent series ID needed to edit the whole series; recurring masters report their raw RFC5545 recurrence rules; and events that are not ordinary confirmed meetings report their event type (outOfOffice, workingLocation, focusTime) and status. Custom reminders (an empty list means none), non-default visibility and transparency are reported too; events using the calendar's default reminders omit the Reminders line. Defaults to False.
        include_attachments (bool): Whether to include attachment information in detailed event output. When True, shows attachment details (fileId, fileUrl, mimeType, title) for events that have attachments. Only applies when detailed=True. Set this to True when you need to view or access files that have been attached to calendar events, such as meeting documents, presentations, or other shared files. Defaults to False.
        single_events (bool): Whether to expand recurring series into individual instances. Defaults to True for backwards compatibility. Set to False with detailed=True to retrieve recurring master events and their exact RFC5545 recurrence rules instead of inferring cadence from expanded instances.

    Returns:
        str: A formatted list of events (summary, start and end times, link) within the specified range, or detailed information for a single event if event_id is provided. When more events remain beyond max_results, a "Next page token" line is appended.
manage_event tool
Manages calendar events. Supports creating, updating, deleting, moving, and RSVP.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform - "create", "update", "delete", "move", or "rsvp".
        summary (Optional[str]): Event title (required for create).
        start_time (Optional[str]): Start time (required for create). An RFC3339 UTC offset identifies the exact instant and is preserved. Without an offset, supply start_timezone or timezone. For a local wall-clock time, omit the offset and pass the zone so Google resolves daylight saving; a wrong offset moves the event. Date-only values create all-day events.
        end_time (Optional[str]): End time (required for create). An RFC3339 UTC offset identifies the exact instant and is preserved. Without an offset, supply end_timezone or timezone. All-day end dates are exclusive.
        event_id (Optional[str]): Event ID (required for update, delete, move, and rsvp).
        calendar_id (str): Calendar ID (default: 'primary'). For move, this is the source.
        destination_calendar_id (Optional[str]): Calendar to move the event to, which becomes its organizer (required for move). Only default events can be moved, and the user needs access to both calendars.
        description (Optional[str]): Event description.
        location (Optional[str]): Event location.
        attendees (Optional[List[Union[str, Dict[str, Any]]]]): Attendee email addresses, attendee objects (e.g. {"email": ..., "responseStatus": "accepted"}), or a mix of both.
        timezone (Optional[str]): IANA timezone applied to both boundaries (e.g.,
            "America/New_York"). Converts offset-bearing timestamps without changing their
            instant; interprets offset-free timestamps as local times in this zone.
            Overridden per boundary by start_timezone/end_timezone.
        start_timezone (Optional[str]): IANA timezone for the start boundary only,
            overriding timezone. Use for events whose two ends sit in different zones -
            a flight departing 13:45 "Asia/Jerusalem" and landing 17:50
            "Europe/Amsterdam" is one event authored in two zones. Explicit timestamp
            offsets always preserve the instant, even when the zone differs.
        end_timezone (Optional[str]): IANA timezone for the end boundary only,
            overriding timezone. See start_timezone.
        attachments (Optional[List[str]]): List of Google Drive file URLs or IDs to attach.
            On action="update" this replaces the event's existing attachments rather than
            appending to them, matching the Calendar API's patch semantics.
        add_google_meet (Optional[bool]): Whether to add/remove native Google Meet.
        conference_data (Optional[Dict[str, Any]]): Raw Google Calendar `conferenceData`
            payload to attach a third-party conference (Zoom/Webex/Teams add-on). Use this
            for full control; mutually exclusive with the conference_provider helper params
            and with add_google_meet. (create/update only)
        conference_provider (Optional[str]): Higher-level helper: third-party provider name
            (e.g. "zoom", "webex", "teams"). Requires conference_uri. The MCP builds the
            addOn `conferenceData` block internally. (create/update only)
        conference_uri (Optional[str]): Join URL for the third-party conference (e.g.
            "https://zoom.us/j/123456789"). Required when conference_provider is set.
        conference_passcode (Optional[str]): Optional passcode for the third-party conference.
        conference_id (Optional[str]): Optional provider-side conference/meeting ID.
        reminders (Optional[Union[str, List[Dict[str, Any]]]]): Custom reminder objects.
        use_default_reminders (Optional[bool]): Whether to use default reminders.
        transparency (Optional[str]): "opaque" (busy) or "transparent" (free).
        visibility (Optional[str]): "default", "public", "private", or "confidential".
        color_id (Optional[str]): Event color, by name or ID: lavender (1), sage (2),
            grape (3), flamingo (4), banana (5), tangerine (6), peacock (7),
            graphite (8), blueberry (9), basil (10), tomato (11).
        recurrence (Optional[List[str]]): RFC5545 recurrence rules for a recurring event, e.g. ["RRULE:FREQ=WEEKLY;COUNT=10"].
        guests_can_modify (Optional[bool]): Whether attendees can modify.
        guests_can_invite_others (Optional[bool]): Whether attendees can invite others.
        guests_can_see_other_guests (Optional[bool]): Whether attendees can see other guests.
        response (Optional[str]): RSVP response — "accepted", "declined", "tentative", or "needsAction" (rsvp action only).
        rsvp_comment (Optional[str]): Optional message to include with the RSVP response (rsvp action only).
        send_updates (Optional[str]): Notification behavior: "all", "externalOnly", or "none".
            Defaults to "none" for move and "all" for other actions.
        this_and_following (bool): Update only. With event_id set to a recurring instance ID,
            applies the change to that instance and every later one by ending the original
            series before it and starting a new series there; earlier instances are kept.
            Updating the series ID instead changes every instance, and moving its start or
            recurrence drops past instances that no longer match. Defaults to False.

    Returns:
        str: Confirmation message with event details.
manage_out_of_office tool
Manages Out of Office events on Google Calendar. These special events auto-decline
    meeting invitations and set the user's status to "Out of office" across Google Workspace.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform - "create", "list", "update", or "delete".
        start_time (Optional[str]): Start date/time. Use 'YYYY-MM-DD' for full-day or RFC3339 for partial-day (e.g., '2024-04-05T09:00:00Z'). Date-only values are auto-converted to dateTime (midnight-to-midnight). Required for create.
        end_time (Optional[str]): End date/time (exclusive). Same format as start_time. For a single full day on April 5, use start_time='2026-04-05' and end_time='2026-04-06'. Required for create.
        summary (Optional[str]): Display text on the calendar. Defaults to "Out of Office".
        auto_decline_mode (Optional[str]): How to handle conflicting invitations. One of: "declineAllConflictingInvitations" (default), "declineOnlyNewConflictingInvitations", "declineNone".
        decline_message (Optional[str]): Message included when auto-declining invitations.
        recurrence (Optional[List[str]]): RFC5545 recurrence rules for a recurring Out of Office series, e.g. ["RRULE:FREQ=WEEKLY;COUNT=10"].
        timezone (Optional[str]): Timezone for the event (e.g., "America/New_York", "Europe/London"). Required when using date-only values or dateTime values without an explicit UTC offset.
        time_min (Optional[str]): For "list" action: start of time range. Defaults to current time. Recurring series are expanded into individual instances in the requested range.
        time_max (Optional[str]): For "list" action: end of time range.
        max_results (int): For "list" action: maximum events to return in one page. Defaults to 10.
        event_id (Optional[str]): Event ID. Required for "update" and "delete" actions.
        calendar_id (str): Calendar ID. Defaults to 'primary'. Out of Office status events live on primary calendars, so use 'primary' or a user's primary calendar ID/email rather than a secondary calendar ID.
        page_token (Optional[str]): For "list" action: token for the next page, taken from a previous response. Also pass the response's Pagination time_min as time_min, even if omitted on the first call. Keep all other query parameters unchanged.

    Returns:
        str: Confirmation message with event details, or a formatted list of OOO events.
manage_focus_time tool
Manages Focus Time events on Google Calendar. These special events auto-decline
    meeting invitations and, by default, set the user's chat status to Do Not
    Disturb, helping protect blocks of uninterrupted work time.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform - "create", "list", "update", or "delete".
        start_time (Optional[str]): Start date/time. Use 'YYYY-MM-DD' for full-day or RFC3339 for partial-day (e.g., '2024-04-05T09:00:00Z'). Date-only values are auto-converted to dateTime (midnight-to-midnight). Required for create.
        end_time (Optional[str]): End date/time (exclusive). Same format as start_time. For a single full day on April 5, use start_time='2026-04-05' and end_time='2026-04-06'. Required for create.
        summary (Optional[str]): Display text on the calendar. Defaults to "Focus Time".
        description (Optional[str]): Event description. Useful for adding context about what the focus time is for.
        auto_decline_mode (Optional[str]): How to handle conflicting invitations. One of: "declineAllConflictingInvitations" (default), "declineOnlyNewConflictingInvitations", "declineNone".
        decline_message (Optional[str]): Message included when auto-declining invitations.
        chat_status (Optional[str]): Google Chat status during the focus time. Supports "doNotDisturb" (default) and "available".
        recurrence (Optional[List[str]]): RFC5545 recurrence rules for a recurring Focus Time series, e.g. ["RRULE:FREQ=WEEKLY;COUNT=10"].
        timezone (Optional[str]): Timezone for the event (e.g., "America/New_York", "Europe/London"). Required when using date-only values or dateTime values without an explicit UTC offset.
        time_min (Optional[str]): For "list" action: start of time range. Defaults to current time. Recurring series are expanded into individual instances in the requested range.
        time_max (Optional[str]): For "list" action: end of time range.
        max_results (int): For "list" action: maximum events to return in one page. Defaults to 10.
        event_id (Optional[str]): Event ID. Required for "update" and "delete" actions.
        calendar_id (str): Calendar ID. Defaults to 'primary'. Focus Time status events live on primary calendars, so use 'primary' or a user's primary calendar ID/email rather than a secondary calendar ID.
        page_token (Optional[str]): For "list" action: token for the next page, taken from a previous response. Also pass the response's Pagination time_min as time_min, even if omitted on the first call. Keep all other query parameters unchanged.

    Returns:
        str: Confirmation message with event details, or a formatted list of Focus Time events.
query_freebusy tool
Returns free/busy information for a set of calendars.

    Args:
        user_google_email (str): The user's Google email address. Required.
        time_min (str): The start of the interval for the query in RFC3339 format (e.g., '2024-05-12T10:00:00Z' or '2024-05-12').
        time_max (str): The end of the interval for the query in RFC3339 format (e.g., '2024-05-12T18:00:00Z' or '2024-05-12').
        calendar_ids (Optional[List[str]]): List of calendar identifiers to query. If not provided, queries the primary calendar. Use 'primary' for the user's primary calendar or specific calendar IDs obtained from `list_calendars`.
        group_expansion_max (Optional[int]): Maximum number of calendar identifiers to be provided for a single group. Optional. An error is returned for a group with more members than this value. Maximum value is 100.
        calendar_expansion_max (Optional[int]): Maximum number of calendars for which FreeBusy information is to be provided. Optional. Maximum value is 50.

    Returns:
        str: A formatted response showing free/busy information for each requested calendar, including busy time periods.
manage_calendar tool
Creates secondary Google Calendars and manages who a calendar is shared with (its access control rules).

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): Action to perform. One of:
            - "create": Create a new secondary calendar. Uses summary, description, timezone.
            - "list_sharing": List the calendar's sharing rules. Uses calendar_id, page_token.
            - "share": Grant access to the calendar. Uses calendar_id, role, scope_type, scope_value, send_notifications.
            - "update_sharing": Change the role of an existing rule. Uses calendar_id, rule_id, role, send_notifications.
            - "unshare": Remove an existing rule. Uses calendar_id, rule_id.
        summary (Optional[str]): The title/name of the new calendar. Required for "create".
        description (Optional[str]): An optional description for the new calendar. Used by "create".
        timezone (Optional[str]): IANA timezone for the new calendar (e.g. 'America/New_York'). Used by "create".
        calendar_id (str): Calendar ID for the sharing actions. Defaults to 'primary'.
        role (Optional[str]): Access level for "share" and "update_sharing". One of: "freeBusyReader", "reader", "writerWithoutPrivateAccess", "writer", "owner", "none".
        scope_type (str): Who "share" grants access to: "user", "group", "domain", or "default" (public). Defaults to "user".
        scope_value (Optional[str]): Email address for "user"/"group" or domain name for "domain". Required for "share" unless scope_type is "default".
        rule_id (Optional[str]): Rule ID from "list_sharing" (e.g. "user:[email protected]"). Required for "update_sharing" and "unshare".
        send_notifications (bool): Whether to email the grantee on "share" and "update_sharing". Defaults to True.
        page_token (Optional[str]): For "list_sharing" action: token for the next page, taken from a previous response.

    Returns:
        str: The new calendar's summary and ID, the calendar's sharing rules, or a confirmation of the rule that changed.
list_spaces tool
Lists Google Chat spaces (rooms and direct messages) accessible to the user,
    or the members of one space.

    Args:
        space_id: Space (spaces/X or a bare ID X) whose members to list instead
            of spaces, up to page_size: people, apps and groups with role and
            invite state.

    Returns:
        str: A formatted list of Google Chat spaces, or of the members of space_id.
get_messages tool
Retrieves messages from a Google Chat space.

    Args:
        message_filter: Optional filter string using the Chat API filter syntax.
                        Supports createTime and thread.name.
                        Examples:
                          'createTime > "2026-03-18T00:00:00-03:00"'
                          'createTime > "2026-03-18T00:00:00-03:00" AND createTime < "2026-03-19T00:00:00-03:00"'
                          'thread.name = spaces/X/threads/Y'
        page_token: Token for the next page, taken from a previous response. Keep all other arguments unchanged.

    Returns:
        str: Formatted messages from the specified space. When more messages
            remain, a "Next page token" line is appended.
send_message tool
Sends a message to a Google Chat space, or edits a message already sent there.

    Args:
        thread_name: Reply in an existing thread by its resource name (e.g. spaces/X/threads/Y).
        thread_key: Reply in a thread by app-defined key (creates thread if not found).
        message_name: Edit this message in place instead of sending a new one
            (e.g. spaces/X/messages/Y, as returned by send_message or get_messages).
            Must be a message of space_id. Only the text is replaced, and only the
            author can edit their own message.

    Returns:
        str: Confirmation message with the sent or updated message details.
search_messages tool
Searches for messages in Google Chat spaces by text content and/or time range.

    Args:
        query: Optional text to search for. If omitted, only time_filter is applied.
        space_id: Optional space to restrict the search to.
        page_size: Maximum number of messages to return per space.
        time_filter: Optional filter using Chat API createTime syntax.
                     Examples:
                       'createTime > "2026-03-18T00:00:00-03:00"'
                       'createTime > "2026-03-18T00:00:00-03:00" AND createTime < "2026-03-19T00:00:00-03:00"'
        max_spaces: Maximum number of spaces to search when space_id is not provided (default 10).

    Returns:
        str: A formatted list of messages matching the search criteria.
create_reaction tool
Adds an emoji reaction to a Google Chat message.

    Args:
        message_id: The message resource name (e.g. spaces/X/messages/Y).
        emoji_unicode: The emoji character to react with (e.g. 👍).

    Returns:
        str: Confirmation message.
download_chat_attachment tool
Downloads an attachment from a Google Chat message and saves it to local disk.

    In stdio mode, returns the local file path for direct access.
    In HTTP mode, returns a temporary download URL (valid for 1 hour).

    Args:
        message_id: The message resource name (e.g. spaces/X/messages/Y).
        attachment_index: Zero-based index of the attachment to download (default 0).

    Returns:
        str: Attachment metadata with either a local file path or download URL.
list_contacts tool
List contacts for the authenticated user, optionally as a full or incremental sync.

    Args:
        user_google_email (str): The user's Google email address. Required.
        page_size (int): Maximum number of contacts to return (default: 100, max: 1000).
        page_token (Optional[str]): Token for pagination. Keep all other arguments unchanged when following it.
        sort_order (Optional[str]): Sort order: "LAST_MODIFIED_ASCENDING", "LAST_MODIFIED_DESCENDING", "FIRST_NAME_ASCENDING", or "LAST_NAME_ASCENDING". Not supported when syncing.
        request_sync_token (bool): Start a full sync. The last page returns a sync token.
        sync_token (Optional[str]): List only changes since the sync that returned this token, marking deleted contacts. The last page returns a new sync token.

    Returns:
        str: List of contacts with their basic information.
get_contact tool
Get detailed information about a specific contact.

    Args:
        user_google_email (str): The user's Google email address. Required.
        contact_id (str): The contact ID (e.g., "c1234567890" or full resource name "people/c1234567890").

    Returns:
        str: Detailed contact information.
search_contacts tool
Search contacts by name, email, phone number, or other fields.

    Args:
        user_google_email (str): The user's Google email address. Required.
        query (str): Search query string (searches names, emails, phone numbers).
        page_size (int): Maximum number of results to return (default: 30, max: 30).

    Returns:
        str: Matching contacts with their basic information.
manage_contact tool
Create, update, or delete a contact. Consolidated tool replacing create_contact,
    update_contact, and delete_contact.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform: "create", "update", or "delete".
        contact_id (Optional[str]): The contact ID. Required for "update" and "delete" actions.
        given_name (Optional[str]): First name (for create/update).
        family_name (Optional[str]): Last name (for create/update).
        phones (Optional[List[Dict]]): List of phone dicts {number, type?}.
            Supported types: mobile, work, home, main, workMobile, internal, other, etc.
            Use type="internal" for internal PBX/ATS short numbers (e.g. 250, 301) — stored
            as a standalone number without + prefix, displayed as "Internal: 250".
        emails (Optional[List[Dict]]): List of email dicts {address, type?}.
        organizations (Optional[List[Dict]]): List of org dicts {name?, title?, department?, jobDescription?, type?}.
        nicknames (Optional[List[Dict]]): List of nickname dicts {value, type?}.
            Useful for bilingual contacts (e.g. Hebrew/English alternative forms). Android dialer
            and WhatsApp search both index nicknames, enabling cross-script lookup.
            Supported types: default, alternate_name, maiden_name, initials, other, etc.
        urls (Optional[List[Dict]]): List of URL dicts {value, type?}.
            Supported types: homepage, blog, profile, work, ftp, reservations, other, etc.
        user_defined (Optional[List[Dict]]): List of custom field dicts {key, value}.
            Useful for structured data like account numbers, IDs, or custom dates.
        relations (Optional[List[Dict]]): List of relation dicts {person, type?}.
            Supported types: spouse, child, parent, friend, manager, assistant, etc.
        notes (Optional[str]): Additional notes (for create/update).
        address (Optional[str]): Street address, replacing any existing addresses. "" clears them (for create/update).
        birthday (Optional[str]): Birthday as 'YYYY-MM-DD', 'MM-DD' (no year), or 'clear'/'' to remove.
        phones_mode (str): How to update phones on "update": "merge" (default), "replace", or "remove".
            merge = read-modify-write with dedup by canonicalForm/normalized value.
            replace = overwrite all phones with provided list.
            remove = delete phones matching provided numbers.
        emails_mode (str): How to update emails on "update": "merge" (default), "replace", or "remove".
        organizations_mode (str): How to update orgs on "update": "merge" (default), "replace", or "remove".
        nicknames_mode (str): How to update nicknames on "update": "merge" (default), "replace", or "remove".
        urls_mode (str): How to update urls on "update": "merge" (default), "replace", or "remove".
            merge and remove match URLs case-insensitively on scheme and host only, ignoring a trailing slash.
        user_defined_mode (str): How to update custom fields on "update": "merge" (default), "replace", or "remove".
            merge overrides value on matching key; new keys appended.
        relations_mode (str): How to update relations on "update": "merge" (default), "replace", or "remove".
        phone (Optional[str]): [DEPRECATED] Single phone number. Use phones=[{"number":..., "type":"mobile"}].
        email (Optional[str]): [DEPRECATED] Email address. Use emails=[{"address":..., "type":"other"}].
        organization (Optional[str]): [DEPRECATED] Company name. Use organizations=[{"name":...}].
        job_title (Optional[str]): [DEPRECATED] Job title. Use organizations=[{"title":...}].

    Returns:
        str: Result of the action performed.
list_contact_groups tool
List contact groups (labels) for the user.

    Args:
        user_google_email (str): The user's Google email address. Required.
        page_size (int): Maximum number of groups to return (default: 100, max: 1000).
        page_token (Optional[str]): Token for pagination.

    Returns:
        str: List of contact groups with their details.
get_contact_group tool
Get details of a specific contact group including its members.

    Args:
        user_google_email (str): The user's Google email address. Required.
        group_id (str): The contact group ID.
        max_members (int): Maximum number of members to return (default: 100, max: 1000).

    Returns:
        str: Contact group details including members.
manage_contacts_batch tool
Batch create, update, or delete contacts. Consolidated tool replacing
    batch_create_contacts, batch_update_contacts, and batch_delete_contacts.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform: "create", "update", or "delete".
        contacts (Optional[List[Dict]]): List of contact dicts for "create" action.
            Each dict may contain: given_name, family_name, phones, emails,
            organizations, nicknames, urls, user_defined, relations, notes, address,
            birthday. Deprecated: phone, email, organization, job_title.
        updates (Optional[List[Dict]]): List of update dicts for "update" action.
            Each dict must contain contact_id and may contain the same fields as contacts.
        contact_ids (Optional[List[str]]): List of contact IDs for "delete" action.
        field (str): For "update" action, the single People API field to update across
            all contacts in this batch. Required. Must be one of: names, phoneNumbers,
            emailAddresses, organizations, nicknames, urls, userDefined, relations,
            biographies, addresses, birthdays. Using a single field per batch call prevents
            unintentional data loss from a union updateMask overwriting unrelated fields.

    Returns:
        str: Result of the batch action performed.
manage_contact_group tool
Create, update, delete a contact group, or modify its members. Consolidated tool
    replacing create_contact_group, update_contact_group, delete_contact_group, and
    modify_contact_group_members.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform: "create", "update", "delete", or "modify_members".
        group_id (Optional[str]): The contact group ID. Required for "update", "delete",
            and "modify_members" actions.
        name (Optional[str]): The group name. Required for "create" and "update" actions.
        delete_contacts (bool): If True and action is "delete", also delete contacts in
            the group (default: False).
        add_contact_ids (Optional[List[str]]): Contact IDs to add (for "modify_members").
        remove_contact_ids (Optional[List[str]]): Contact IDs to remove (for "modify_members").

    Returns:
        str: Result of the action performed.
search_docs tool
Searches for Google Docs by name using Drive API (mimeType filter).

    Args:
        user_google_email: The user's Google email address.
        query: Text to search for in document names.
        page_size: Maximum number of documents to return. Defaults to 10.
        page_token: Page token from a previous response's nextPageToken to
            retrieve the next page of results.
        corpora: Corpus to search ('user', 'domain', 'drive', 'allDrives').
            Defaults to 'drive' when drive_id is set, otherwise 'allDrives'.
        drive_id: Optional shared drive ID to search.

    Returns:
        str: A formatted list of Google Docs matching the search query.
            Includes a nextPageToken line when more results are available.
get_doc_content tool
Retrieves content of a Google Doc or a Drive file (like .docx) identified by document_id.
    - Native Google Docs: Fetches content via Docs API.
    - Office files (.docx, etc.) stored in Drive: Downloads via Drive API and extracts text.

    By default, native Google Docs text is index-aligned with the document:
    empty paragraphs are preserved and every non-text element that occupies an
    index (inline object, page break, footnote reference, ...) is rendered as one
    U+FFFC placeholder per index. The document body starts at index 1, so an
    offset n into the text that follows "--- CONTENT ---" is document index n + 1,
    and that index can be passed straight to format_text or delete_text. Tables
    and multi-tab documents interleave separators, so alignment holds up to the
    first table or tab header.

    Set preserve_context=True for readable link destinations, internal targets,
    smart-chip values, table boundaries, headers, footers, footnotes, and object
    context exposed by the Docs API. This output is plain text, not Markdown,
    and its offsets must not be used as document editing indices. Comments,
    revision history, exact visual layout, and chip details hidden by the API
    are not included. Use get_doc_as_markdown for formatting or comments.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the Google Doc or Drive file (or full URL). A Docs
            URL's ?tab= selects that tab unless tab_id is also specified.
        suggestions_view_mode: How to render suggestions in the returned content:
            - "DEFAULT_FOR_CURRENT_ACCESS": Default based on user's access level
            - "SUGGESTIONS_INLINE": Suggested changes appear inline in the document
            - "PREVIEW_SUGGESTIONS_ACCEPTED": Preview as if all suggestions were accepted
            - "PREVIEW_WITHOUT_SUGGESTIONS": Preview as if all suggestions were rejected
        tab_id: Optional ID of a single tab to read (from inspect_doc_structure).
            When given, only that tab's content is returned with no tab separator,
            so the default output stays index-aligned with that tab. When
            omitted, every tab is returned with "--- TAB: ... ---" markers.
            Pass "" to read every tab of a URL that carries ?tab=. This
            filters output only: the whole document is still fetched.
        preserve_context: Include readable semantic annotations for native Docs.
            Defaults to False to retain index alignment. Office extraction is
            unaffected. With tab_id, only the selected tab is rendered.
        heading: Text of a body heading (case-insensitive, must match exactly one)
            whose section to return instead of the whole document: the heading and
            everything below it up to the next heading of equal or shallower level.
            The header reports the section's start index s, and in the default
            output offset n is document index n + s. Native Google Docs only;
            tab_id is required when the doc has multiple tabs.
        heading_level: Optional 1-6 heading level to narrow the heading match.

    Returns:
        str: The document content with metadata header.
list_docs_in_folder tool
Lists Google Docs within a specific Drive folder.

    Args:
        user_google_email: The user's Google email address.
        folder_id: ID of the Drive folder to list. Defaults to 'root'.
        page_size: Maximum number of documents to return. Defaults to 100.
        page_token: Page token from a previous response's nextPageToken to
            retrieve the next page of results.

    Returns:
        str: A formatted list of Google Docs in the specified folder.
            Includes a nextPageToken line when more results are available.
create_doc tool
Creates a new Google Doc and optionally inserts initial content.

    `content` is inserted as plain text (Markdown is not rendered); use
    import_to_google_doc to create a doc from Markdown.

    After creation, the document body starts at index 1. A new empty doc
    has total length 2 (one section break at index 0, one newline at index 1).

    To build a rich document after creation, use batch_update_doc with
    insert_text operations using end_of_segment=true to append content
    sequentially without calculating indices. Then call inspect_doc_structure
    to get exact positions before applying formatting in a separate batch call.

    Args:
        user_google_email: User's Google email address
        title: Title of the new document
        content: Optional initial plain text content to insert
        folder_id: The ID of the parent folder. Defaults to 'root'. For shared
            drives, this must be a folder ID within the shared drive.

    Returns:
        str: Confirmation message with document ID, link, and initial document state.
modify_doc_text tool
Modifies text in a Google Doc - can insert/replace text and/or apply formatting in a single operation.

    TIP: To append text to the end of the document without calculating indices,
    set end_of_segment=true. This avoids index calculation errors.

    HEADING MODE: Pass heading instead of start_index to edit the body below a
    heading, up to the next heading of equal or shallower level. text is
    rendered as Markdown and replaces that body; end_of_segment=true appends
    instead. Formatting parameters without text format the whole body.

    For ordinary header/footer text, prefer update_doc_headers_footers.
    Only pass segment_id when you already have a real header/footer/footnote
    segment ID from inspect_doc_structure output. Do not guess IDs such as
    "kix.header" or "kix.footer".

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        start_index: Start position for operation using Docs API indices from
            inspect_doc_structure. For the main body, 0 is also accepted as an
            alias for the first writable position. Required unless heading is set.
        end_index: End position for text replacement/formatting (if not provided with text, text is inserted)
        text: New text to insert or replace with (optional - can format existing text without changing it).
            Rendered as Markdown when heading is set.
        heading: Text of a body heading (case-insensitive, must match exactly one) whose
            section to edit instead of start_index/end_index
        heading_level: Optional 1-6 heading level to narrow the heading match
        tab_id: Optional document tab ID to target (required with heading when the doc has multiple tabs)
        segment_id: Optional header/footer/footnote segment ID to target
        end_of_segment: Insert text at the end of the targeted segment instead of start_index
        bold: Whether to make text bold (True/False/None to leave unchanged)
        italic: Whether to make text italic (True/False/None to leave unchanged)
        underline: Whether to underline text (True/False/None to leave unchanged)
        strikethrough: Whether to strike through text (True/False/None to leave unchanged)
        font_size: Font size in points
        font_family: Font family name (e.g., "Arial", "Times New Roman")
        font_weight: Font weight (100-900 in steps of 100; requires font_family)
        text_color: Foreground text color (#RRGGBB)
        background_color: Background/highlight color (#RRGGBB)
        link_url: Hyperlink URL (http/https)
        clear_link: Remove hyperlink from the target range
        baseline_offset: One of NONE, SUPERSCRIPT, SUBSCRIPT
        small_caps: Whether to apply small caps

    Returns:
        str: Confirmation message with operation details
find_and_replace_doc tool
Finds and replaces text throughout a Google Doc. No index calculation required.

    This is the safest way to update specific text in a document because it
    does not require knowing any indices. Use this tool when you need to:
    - Replace placeholder text (e.g., {{TITLE}}) with real content
    - Update specific words or phrases throughout the document
    - Make targeted text changes without risk of index errors

    For building documents from scratch, consider inserting text with unique
    placeholders via batch_update_doc, then using this tool to replace them.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        find_text: Text to search for
        replace_text: Text to replace with
        match_case: Whether to match case exactly
        tab_id: Optional ID of the tab to target

    Returns:
        str: Confirmation message with replacement count
insert_doc_elements tool
Inserts structural elements like tables, lists, or page breaks into a Google Doc.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        element_type: Type of element to insert ("table", "list", "page_break")
        index: Position to insert element (0-based)
        rows: Number of rows for table (required for table)
        columns: Number of columns for table (required for table)
        list_type: Type of list ("UNORDERED", "ORDERED") (required for list)
        text: Initial text content for list items

    Returns:
        str: Confirmation message with insertion details
insert_doc_image tool
Inserts an image into a Google Doc from Drive or a URL.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        image_source: Drive file ID or public image URL
        index: Position to insert image (0-based)
        width: Image width in points (optional)
        height: Image height in points (optional)

    Returns:
        str: Confirmation message with insertion details
update_doc_headers_footers tool
Safely creates or updates header/footer text in a Google Doc.

    This is the default tool for header/footer content. Do NOT use
    batch_update_doc with create_header_footer just to set header/footer text;
    that low-level operation is only for advanced section-break workflows and
    can fail when the default header/footer already exists.

    This tool handles both creation and update in one call:
    - If the header/footer does not exist, it is automatically created first.
    - If the header/footer already exists, its content is replaced.

    You do NOT need to create a header/footer separately before calling this tool.
    Simply call it with the desired content and it will work whether the
    header/footer exists or not.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        section_type: Type of section to create or update ("header" or "footer")
        content: Text content for the header/footer
        header_footer_type: Type of header/footer ("DEFAULT", "FIRST_PAGE_ONLY", "EVEN_PAGE")

    Returns:
        str: Confirmation message with update details
batch_update_doc tool
Executes multiple low-level document operations in a single atomic batch update.

    For normal header/footer text, prefer update_doc_headers_footers.
    Only use create_header_footer here for advanced section-break layouts.

    RECOMMENDED WORKFLOW FOR BUILDING DOCUMENTS:
    =============================================
    To avoid index calculation errors, build documents in phases:

    PHASE 1 - INSERT ALL CONTENT (use end_of_segment=true, no index math):
      Append text, section breaks, and page breaks sequentially.
      Each operation appends to the end of the body. No index needed.
      Example batch: [
        {"type": "insert_text", "end_of_segment": true, "text": "Report Title\\\\n"},
        {"type": "insert_text", "end_of_segment": true, "text": "\\\\nExecutive Summary\\\\n"},
        {"type": "insert_text", "end_of_segment": true, "text": "Revenue grew 15%.\\\\n"},
        {"type": "insert_section_break", "end_of_segment": true, "section_type": "NEXT_PAGE"},
        {"type": "insert_text", "end_of_segment": true, "text": "Detailed Analysis\\\\n"}
      ]

    PHASE 2 - CREATE HEADERS/FOOTERS (if needed):
      For normal header/footer text, use update_doc_headers_footers
      (it auto-creates if missing and writes the content for you).
      Only include create_header_footer operations in a batch when you are
      intentionally managing advanced section-break-specific layouts.

    PHASE 3 - INSPECT STRUCTURE:
      Call inspect_doc_structure with detailed=true to get exact start_index
      and end_index for every paragraph and element.

    PHASE 4 - APPLY FORMATTING (separate batch using indices from Phase 3):
      Use the real indices from inspect_doc_structure output: [
        {"type": "update_paragraph_style", "start_index": 1, "end_index": 15,
         "heading_level": 1, "alignment": "CENTER"},
        {"type": "format_text", "start_index": 1, "end_index": 15,
         "bold": true, "font_size": 24},
        {"type": "create_bullet_list", "start_index": 50, "end_index": 120,
         "list_type": "ORDERED"}
      ]

    ALTERNATIVE - FIND_REPLACE PATTERN (no indices needed at all):
      Insert text with unique placeholders, then use find_replace:
      [
        {"type": "insert_text", "end_of_segment": true, "text": "{{TITLE}}\\\\n{{BODY}}\\\\n"},
        {"type": "find_replace", "find_text": "{{TITLE}}", "replace_text": "Quarterly Report"},
        {"type": "find_replace", "find_text": "{{BODY}}", "replace_text": "The results show..."}
      ]

    ALTERNATIVE - SEMANTIC ANCHORS (target existing structure without indices):
      Insertion operations accept after_heading, before_heading, or anchor_text with
      anchor_position instead of index. Each is resolved against the document at
      execution time, so it cannot go stale the way a pre-computed index can, and
      an anchor matching zero or several places is refused rather than guessed.
      Submit anchored insertions in their own batch; they execute from highest
      index to lowest to keep targets stable. [
        {"type": "insert_text", "after_heading": "Results",
         "text": "Revenue grew 15%.\\\\n"},
        {"type": "insert_text", "anchor_text": "Conclusion",
         "anchor_position": "before", "text": "See appendix.\\\\n"}
      ]

    WARNING - AVOID THIS ANTI-PATTERN:
      Do NOT pre-compute sequential indices for multiple insert_text operations.
      Each insertion shifts all subsequent indices and manual calculation is error-prone.
      Use end_of_segment=true instead, which always appends to the current end.
      BAD:  [{"type":"insert_text","index":1,"text":"Hello\\\\n"},
             {"type":"insert_text","index":8,"text":"World\\\\n"}]  <- index 8 may be wrong
      GOOD: [{"type":"insert_text","end_of_segment":true,"text":"Hello\\\\n"},
             {"type":"insert_text","end_of_segment":true,"text":"World\\\\n"}]

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        operations: List of operation dicts. Each operation MUST have a 'type' field.
                    All operations accept an optional 'tab_id' to target a specific tab.

    Supported operation types and their parameters:

      insert_text      - required: text (str)
                         PREFERRED: end_of_segment (bool) - set true to append at end
                           of body without calculating an index. Safest way to build
                           documents sequentially.
                         optional: index (int), tab_id, segment_id
      delete_text      - required: start_index (int), end_index (int)
                         optional: tab_id, segment_id
      replace_text     - required: start_index (int), end_index (int), text (str)
                         optional: tab_id, segment_id
      format_text      - required: start_index (int), end_index (int)
                         optional: bold, italic, underline, strikethrough, font_size,
                                   font_family, font_weight, text_color, background_color,
                                   link_url, clear_link, baseline_offset, small_caps,
                                   tab_id, segment_id
      update_paragraph_style
                       - required: start_index (int), end_index (int)
                         optional: heading_level (0-6, 0=normal), alignment
                                   (START/CENTER/END/JUSTIFIED), line_spacing,
                                   indent_first_line, indent_start, indent_end,
                                   space_above, space_below, named_style_type,
                                   direction, keep_lines_together, keep_with_next,
                                   avoid_widow_and_orphan, page_break_before,
                                   spacing_mode, shading_color, border_edges,
                                   border_color, border_width, border_padding,
                                   border_dash, tab_id, segment_id
      update_table_cell_style
                       - required: table_start_index (int)
                         optional: background_color, border_color, border_width,
                                   padding_top, padding_bottom, padding_left,
                                   padding_right (float, points),
                                   content_alignment ("TOP"|"MIDDLE"|"BOTTOM"),
                                   row_index, column_index, row_span, column_span,
                                   border_edges ("top"|"bottom"|"left"|"right")
                         Use inspect_doc_structure to find table_start_index from
                         table_details[].start_index. If row/column values are
                         omitted, the style is applied to the entire table.
      insert_table     - required: rows (int), columns (int)
                         optional: index (int), tab_id, segment_id, end_of_segment
      insert_table_row - required: table_start_index (int), row_index (int)
                         optional: insert_below (bool, default true), tab_id
      delete_table_row - required: table_start_index (int), row_index (int)
                         optional: tab_id
      insert_table_column
                       - required: table_start_index (int), column_index (int)
                         optional: insert_right (bool, default true), tab_id
      delete_table_column
                       - required: table_start_index (int), column_index (int)
                         optional: tab_id
      merge_table_cells
                       - required: table_start_index (int), row_index (int),
                                   column_index (int), row_span (int), column_span (int)
                         optional: tab_id
      unmerge_table_cells
                       - required: table_start_index (int), row_index (int),
                                   column_index (int), row_span (int), column_span (int)
                         optional: tab_id
      update_table_column_properties
                       - required: table_start_index (int), column_indices (list[int])
                         optional: width (float, points), width_type
                                   (FIXED_WIDTH|EVENLY_DISTRIBUTED), tab_id
      update_table_row_style
                       - required: table_start_index (int), row_indices (list[int])
                         optional: min_row_height (float, points), tab_id
      pin_table_header_rows
                       - required: table_start_index (int),
                                   pinned_header_rows_count (int)
                         optional: tab_id
                         Set pinned_header_rows_count=1 to repeat the first row as
                         a header across page breaks (0 unpins all rows). This is
                         the writable request for the tableHeader state reported
                         in TableRowStyle.
      insert_page_break- optional: index (int), end_of_segment, tab_id
      insert_person    - required: email (str)
                         optional: index (int), end_of_segment, tab_id, segment_id
                         Inserts an @mention person smart chip.
      insert_date      - required: date (str, YYYY-MM-DD or ISO 8601 with a time zone)
                         optional: index (int), end_of_segment, tab_id, segment_id,
                         date_format, time_format, timezone
                         Inserts a date smart chip.
      insert_section_break
                       - optional: index (int), end_of_segment, section_type
                                   ('CONTINUOUS'|'NEXT_PAGE')
      find_replace     - required: find_text (str), replace_text (str)
                         optional: match_case (bool, default false)
      create_bullet_list - required: start_index (int), end_index (int)
                         optional: list_type ('UNORDERED'|'ORDERED'|'CHECKBOX'|'NONE',
                                   default UNORDERED), nesting_level (0-8),
                                   paragraph_start_indices (list[int]), bullet_preset
                         Use list_type='NONE' to remove existing bullet/list formatting
      create_named_range
                       - required: name (str), start_index (int), end_index (int)
                         optional: tab_id, segment_id
      replace_named_range_content
                       - required: text (str)
                         optional: named_range_id, named_range_name, tab_id
      delete_named_range
                       - optional: named_range_id, named_range_name, tab_id
      update_document_style
                       - optional: background_color, margin_top, margin_bottom,
                                   margin_left, margin_right, margin_header,
                                   margin_footer, page_width, page_height,
                                   page_number_start, use_even_page_header_footer,
                                   use_first_page_header_footer,
                                   flip_page_orientation, document_mode, tab_id
      update_section_style
                       - required: start_index (int), end_index (int)
                         optional: margin_top, margin_bottom, margin_left,
                                   margin_right, margin_header, margin_footer,
                                   page_number_start, use_first_page_header_footer,
                                   flip_page_orientation, content_direction,
                                   column_count, column_spacing,
                                   column_separator_style
      create_header_footer
                       - required: section_type ('header'|'footer')
                         optional: header_footer_type, section_break_index
                         Advanced only. For ordinary header/footer text, use
                         update_doc_headers_footers instead.
      insert_image     - required: image_uri (str)
                         optional: index, width, height, tab_id, segment_id,
                                   end_of_segment
      insert_doc_tab   - required: title (str), index (int)
                         optional: parent_tab_id (str)
      delete_doc_tab   - required: tab_id (str)
      update_doc_tab   - required: tab_id (str), title (str)

    Example - Safe document building (no index calculation needed):
        [
            {"type": "insert_text", "end_of_segment": true, "text": "Quarterly Report\\\\n\\\\n"},
            {"type": "insert_text", "end_of_segment": true, "text": "Executive Summary\\\\n"},
            {"type": "insert_text", "end_of_segment": true, "text": "Revenue grew 15% YoY.\\\\n"}
        ]

    Example - Formatting (use exact indices from inspect_doc_structure output):
        [
            {"type": "format_text", "start_index": 1, "end_index": 19, "bold": true, "font_size": 24},
            {"type": "update_paragraph_style", "start_index": 1, "end_index": 19,
             "heading_level": 1, "alignment": "CENTER"},
            {"type": "update_paragraph_style", "start_index": 20, "end_index": 39, "heading_level": 2}
        ]

    Example - Using find_replace (zero index risk):
        [
            {"type": "find_replace", "find_text": "{{DATE}}", "replace_text": "March 2026"},
            {"type": "find_replace", "find_text": "{{AUTHOR}}", "replace_text": "Jane Smith"}
        ]

    Example - Insert table at end of document:
        [{"type": "insert_table", "end_of_segment": true, "rows": 3, "columns": 4}]

    Example - Headers, footers, and document style:
        [
            {"type": "create_header_footer", "section_type": "header"},
            {"type": "create_header_footer", "section_type": "footer"},
            {"type": "update_document_style", "margin_top": 72, "margin_bottom": 72}
        ]

    Returns:
        str: Confirmation message with batch results and document length for chaining
inspect_doc_structure tool
Essential tool for finding safe insertion points and understanding document structure.

    USE THIS FOR:
    - Finding the correct index for table insertion
    - Understanding document layout before making changes
    - Locating existing tables and their positions
    - Getting document statistics and complexity info
    - Inspecting structure of specific tabs

    CRITICAL FOR TABLE OPERATIONS:
    ALWAYS call this BEFORE creating tables to get a safe insertion index.

    WHAT THE OUTPUT SHOWS:
    - total_elements: Number of document elements
    - total_length: Maximum safe index for insertion
    - tables: Number of existing tables
    - table_details: Position and dimensions of each table
    - headers / footers: Real segment IDs and previews for header/footer editing
    - tabs: List of available tabs in the document (if no tab_id specified)
    - empty_paragraphs: newline-only count, excluding existing/suggested object anchors
    - empty_paragraph_ranges: start/end extents, capped at 100
    - empty_paragraph_ranges_truncated: whether ranges were omitted
    - last_paragraph: is_list_item and is_empty, or null if no body paragraphs

    Paragraph statistics cover top-level body paragraphs and appear at the top
    level in basic mode or under "statistics" in detailed mode.
    Ranges can include required empty paragraphs. Before cleanup, use detailed=true
    to check adjacent elements, formatting, and object anchors. Preserve the final
    newline and newlines before tables, tables of contents, or section breaks.
    If the body ends with an empty paragraph, that paragraph's range has
    end == total_length; truncation may omit that range.

    WORKFLOW FOR TABLE INSERTION:
    Step 1: Call this function
    Step 2: Note the "total_length" value
    Step 3: Use an index < total_length for table insertion
    Step 4: Create your table

    FORMATTING WORKFLOW:
    After inserting all text via batch_update_doc with end_of_segment=true,
    call this tool with detailed=true to get exact start_index and end_index
    for every paragraph. Use those indices directly in format_text and
    update_paragraph_style operations in a second batch_update_doc call.

    HEADER/FOOTER WORKFLOW:
    For ordinary header/footer text, use update_doc_headers_footers.
    If you need low-level segment editing, call this tool first and use the
    real segment_id values returned under headers/footers. Do not invent IDs.

    The detailed output includes elements[].start_index and elements[].end_index
    with text_preview for each paragraph, making it easy to identify which
    ranges to format.

    SUB-PARAGRAPH FORMATTING:
    text_preview is truncated to 100 characters by default. To compute the index
    of a token inside a longer paragraph, pass preview_chars=0 or None for untruncated
    text, then add the token's UTF-16 offset within that text to the paragraph's
    start_index (non-BMP characters such as emoji occupy two UTF-16 units).

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to inspect
        detailed: Whether to return detailed structure information
        tab_id: Optional ID of the tab to inspect. If not provided, inspects main document.
        preview_chars: Maximum characters of paragraph, header and footer text
            preview. Pass 0 or None for the full text, needed to locate a token inside a
            paragraph longer than the default 100 characters.

    Returns:
        str: JSON string containing document structure and safe insertion indices
create_table_with_data tool
Creates a table and populates it with data in one reliable operation.

    CRITICAL: YOU MUST CALL inspect_doc_structure FIRST TO GET THE INDEX!

    MANDATORY WORKFLOW - DO THESE STEPS IN ORDER:

    Step 1: ALWAYS call inspect_doc_structure first
    Step 2: Use the 'total_length' value from inspect_doc_structure as your index
    Step 3: Format data as 2D list: [["col1", "col2"], ["row1col1", "row1col2"]]
    Step 4: Call this function with the correct index and data

    EXAMPLE DATA FORMAT:
    table_data = [
        ["Header1", "Header2", "Header3"],    # Row 0 - headers
        ["Data1", "Data2", "Data3"],          # Row 1 - first data row
        ["Data4", "Data5", "Data6"]           # Row 2 - second data row
    ]

    CRITICAL INDEX REQUIREMENTS:
    - NEVER use index values like 1, 2, 10 without calling inspect_doc_structure first
    - ALWAYS get index from inspect_doc_structure 'total_length' field
    - Index must be a valid insertion point in the document

    DATA FORMAT REQUIREMENTS:
    - Must be 2D list of strings only
    - Each inner list = one table row
    - All rows MUST have same number of columns
    - Use empty strings "" for empty cells, never None
    - Use debug_table_structure after creation to verify results

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to update
        table_data: 2D list of strings - EXACT format: [["col1", "col2"], ["row1col1", "row1col2"]]
        index: Document position (MANDATORY: get from inspect_doc_structure 'total_length')
        bold_headers: Whether to make first row bold (default: true)
        tab_id: Optional tab ID to create the table in a specific tab
        header_rows: Number of leading rows to mark as a repeating header that
            reappears after each page break. Must be between 0 and the number of
            table rows (default: 0 = none)

    Returns:
        str: Confirmation with table details and link
debug_table_structure tool
ESSENTIAL DEBUGGING TOOL - Use this whenever tables don't work as expected.

    USE THIS IMMEDIATELY WHEN:
    - Table population put data in wrong cells
    - You get "table not found" errors
    - Data appears concatenated in first cell
    - Need to understand existing table structure
    - Planning to fill existing cells with modify_doc_text at their insertion_index

    WHAT THIS SHOWS YOU:
    - Exact table dimensions (rows × columns)
    - Each cell's position coordinates (row,col)
    - Current content in each cell
    - Insertion indices for each cell
    - Table boundaries and ranges

    HOW TO READ THE OUTPUT:
    - "dimensions": "2x3" = 2 rows, 3 columns
    - "position": "(0,0)" = first row, first column
    - "current_content": What's actually in each cell right now
    - "insertion_index": Where new text would be inserted in that cell

    WORKFLOW INTEGRATION:
    1. After creating table → Use this to verify structure
    2. Before populating → Use this to plan your data format
    3. After population fails → Use this to see what went wrong
    4. When debugging → Compare your data array to actual table structure

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document to inspect
        table_index: Which table to debug (0 = first table, 1 = second table, etc.)
        tab_id: Optional ID of the tab containing the table (from inspect_doc_structure).
            If not provided, inspects the first tab.

    Returns:
        str: Detailed JSON structure showing table layout, cell positions, and current content
export_doc_to_pdf tool
Exports a Google Doc to PDF format and saves it to Google Drive.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the Google Doc to export
        pdf_filename: Name for the PDF file (optional - if not provided, uses original name + "_PDF")
        folder_id: Drive folder ID to save PDF in (optional - if not provided, saves in root)

    Returns:
        str: Confirmation message with PDF file details and links
update_paragraph_style tool
Apply paragraph-level formatting, heading styles, and/or list formatting to a range in a Google Doc.

    This tool can apply named heading styles (H1-H6) for semantic document structure,
    create bulleted or numbered lists with nested indentation, and customize paragraph
    properties like alignment, spacing, and indentation. All operations can be applied
    in a single call.

    Args:
        user_google_email: User's Google email address
        document_id: Document ID to modify
        start_index: Start position using Docs API indices from
            inspect_doc_structure. For the main body, 0 is also accepted as an
            alias for the first writable position.
        end_index: End position (exclusive) - should cover the entire paragraph
        heading_level: Heading level 0-6 (0 = NORMAL_TEXT, 1 = H1, 2 = H2, etc.)
                       Use for semantic document structure
        alignment: Text alignment - 'START' (left), 'CENTER', 'END' (right), or 'JUSTIFIED'
        line_spacing: Line spacing multiplier (1.0 = single, 1.5 = 1.5x, 2.0 = double)
        indent_first_line: First line indent in points (e.g., 36 for 0.5 inch)
        indent_start: Left/start indent in points
        indent_end: Right/end indent in points
        space_above: Space above paragraph in points (e.g., 12 for one line)
        space_below: Space below paragraph in points
        named_style_type: Direct named style type - 'NORMAL_TEXT', 'TITLE', 'SUBTITLE',
                         'HEADING_1' through 'HEADING_6'. Mutually exclusive with heading_level.
        tab_id: Optional document tab ID to target
        segment_id: Optional header/footer/footnote segment ID to target
        direction: Paragraph direction - 'LEFT_TO_RIGHT' or 'RIGHT_TO_LEFT'
        keep_lines_together: Keep all lines of the paragraph together
        keep_with_next: Keep the paragraph with the next paragraph
        avoid_widow_and_orphan: Avoid widows/orphans for the paragraph
        page_break_before: Start the paragraph on a new page
        spacing_mode: 'NEVER_COLLAPSE' or 'COLLAPSE_LISTS'
        shading_color: Paragraph shading/background color (#RRGGBB)
        border_edges: Paragraph border edges to update ('top', 'bottom', 'left',
                      'right', or 'between'); omit to update all four outer edges
        border_color: Border color (#RRGGBB; defaults to black)
        border_width: Border width in points (defaults to 1)
        border_padding: Border padding in points (defaults to 4)
        border_dash: Border dash style ('SOLID', 'DOT', or 'DASH'; defaults to 'SOLID')
        list_type: Create a list from existing paragraphs ('UNORDERED' for bullets, 'ORDERED' for numbers, 'CHECKBOX' for checklists), or 'NONE' to remove existing list formatting from the range. Use 'NONE' when text inserted after a list has inherited its bullets: setting named_style_type or heading_level does not clear list membership, only 'NONE' does.
        list_nesting_level: Nesting level for lists (0-8, where 0 is top level, default is 0)
                           Use higher levels for nested/indented list items
        bullet_preset: Optional explicit Google Docs bullet preset

    Returns:
        str: Confirmation message with formatting details

    Examples:
        # Apply H1 heading style
        update_paragraph_style(document_id="...", start_index=1, end_index=20, heading_level=1)

        # Create a bulleted list
        update_paragraph_style(document_id="...", start_index=1, end_index=50,
                               list_type="UNORDERED")

        # Create a nested numbered list item
        update_paragraph_style(document_id="...", start_index=1, end_index=30,
                               list_type="ORDERED", list_nesting_level=1)

        # Apply H2 heading with custom spacing
        update_paragraph_style(document_id="...", start_index=1, end_index=30,
                               heading_level=2, space_above=18, space_below=12)

        # Center-align a paragraph with double spacing
        update_paragraph_style(document_id="...", start_index=1, end_index=50,
                               alignment="CENTER", line_spacing=2.0)
get_doc_as_markdown tool
Reads a Google Doc and returns it as clean Markdown with optional comment context.

    Unlike get_doc_content which returns plain text, this tool preserves document
    formatting as Markdown: headings, bold/italic/strikethrough, links, code spans,
    ordered/unordered lists with nesting, and tables.

    When comments are included (the default), each comment's anchor text — the specific
    text the comment was attached to — is preserved, giving full context for the discussion.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the Google Doc (or full URL). When a full URL is provided
            and it contains a ?tab= query parameter, that tab is used automatically
            unless tab_id is also specified (explicit tab_id takes precedence).
        include_comments: Whether to include comments (default: True)
        comment_mode: How to display comments:
            - "inline": Footnote-style references placed at the anchor text location (default)
            - "appendix": All comments grouped at the bottom with blockquoted anchor text
            - "none": No comments included
        include_resolved: Whether to include resolved comments (default: False)
        suggestions_view_mode: How to render suggestions in the returned content:
            - "DEFAULT_FOR_CURRENT_ACCESS": Default based on user's access level
            - "SUGGESTIONS_INLINE": Suggested changes appear inline in the document
            - "PREVIEW_SUGGESTIONS_ACCEPTED": Preview as if all suggestions were accepted
            - "PREVIEW_WITHOUT_SUGGESTIONS": Preview as if all suggestions were rejected
        tab_id: Optional ID of a single tab to read (from inspect_doc_structure).
            When given, only that tab's content is rendered, without its child tabs
            and without a tab heading, and comments are listed as document-wide.
            When omitted, every tab is rendered. Pass "" to read every tab of a
            URL that carries ?tab=. This filters output only: the whole document
            is still fetched.
        include_colors: Follow text that has an explicit RGB foreground color
            with "[color: #rrggbb]" (default: False). Theme colors are not shown.
        heading: Text of a body heading (case-insensitive, must match exactly one)
            whose section to render instead of the whole document: the heading and
            everything below it up to the next heading of equal or shallower level.
            Comments are listed as document-wide. tab_id is required when the doc
            has multiple tabs.
        heading_level: Optional 1-6 heading level to narrow the heading match.

    Returns:
        str: The document content as Markdown, optionally with comments
manage_doc_tab tool
Manage document tabs: create, rename, delete, or populate from Markdown.

    Args:
        user_google_email: User's Google email address
        document_id: ID of the document
        action: Action to perform - "create", "rename", "delete", or "populate_from_markdown"
        tab_id: Tab ID (required for rename, delete, populate_from_markdown; use inspect_doc_structure to find IDs)
        title: Tab title (required for create; used by rename)
        index: Position index for new tab, 0-based among siblings (required for create)
        parent_tab_id: Optional parent tab ID to nest under (create only)
        markdown_text: Markdown source to render (populate_from_markdown only)
        replace_existing: Clear tab body before inserting markdown (default True)

    Returns:
        dict with action result including document link
search_drive_files tool
Searches for files and folders within a user's Google Drive, including shared drives.

    Args:
        user_google_email (str): The user's Google email address. Required.
        query (str): The search query string. Supports Google Drive search operators.
                     NOTE: Owner-based queries ('[email protected]' in owners) DO NOT WORK in Shared Drives
                     because files are owned by the shared drive itself, not individual users.
                     For recent files by a specific user in Shared Drives, search by modifiedTime
                     and use order_by='modifiedTime desc' instead.
        page_size (int): The maximum number of files to return. Defaults to 10.
        page_token (Optional[str]): Page token from a previous response's nextPageToken to retrieve the next page of results.
        drive_id (Optional[str]): ID of the shared drive to search. If None, behavior depends on `corpora` and `include_items_from_all_drives`.
        include_items_from_all_drives (bool): Whether shared drive items should be included in results. Defaults to True. This is effective when not specifying a `drive_id`.
        corpora (Optional[str]): Bodies of items to query (e.g., 'user', 'domain', 'drive', 'allDrives').
                                 If 'drive_id' is specified and 'corpora' is None, it defaults to 'drive'.
                                 Otherwise it defaults to 'allDrives' when `include_items_from_all_drives` is True.
                                 Pass 'user' to search only My Drive and files shared with the user.
        file_type (Optional[str]): Restrict results to a specific file type. Accepts a friendly
                                   name ('folder', 'document'/'doc', 'spreadsheet'/'sheet',
                                   'presentation'/'slides', 'form', 'drawing', 'pdf', 'shortcut',
                                   'script', 'site', 'jam'/'jamboard') or any raw MIME type
                                   string (e.g. 'application/pdf'). Defaults to None (all types).
        detailed (bool): Whether to include size, modified time, and link in results. Defaults to True.
        order_by (Optional[str]): Sort order. Comma-separated list of sort keys with optional 'desc' modifier.
                                  Valid keys: 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime',
                                  'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime',
                                  'starred', 'viewedByMeTime'. Example: 'modifiedTime desc' or 'folder,modifiedTime desc,name'.
                                  Defaults to None (Drive API default ordering).
        include_trashed (bool): Whether to include files in the trash. Defaults to False, matching
                                the Drive web UI and `list_drive_items`. Ignored when `query` already
                                contains its own `trashed` clause (`=` or `!=`), which always wins.

    Returns:
        str: A formatted list of found files/folders with their details (ID, name, type, and optionally size, modified time, link).
             Includes a nextPageToken line when more results are available.
get_drive_file_content tool
Retrieves the content of a specific Google Drive file by ID, supporting files in shared drives.

    • Native Google Docs, Sheets, Slides → exported as text / CSV.
    • Office files (.docx, .xlsx, .pptx) → unzipped & parsed with std-lib to
      extract readable text.
    • PDFs → text extracted with pypdf when possible; scanned/image-only PDFs
      fall back to a download hint.
    • Images (PNG, JPEG, GIF, WebP) → returned as MCP image content after the
      metadata header. SVG → returned as its markup; raster images it embeds
      as base64 are attached as image content, numbered to match their place
      in the markup. BMP and TIFF → base64 text, or a download hint when over
      the default page size.
    • Any other file → downloaded; tries UTF-8 decode, else notes binary.

    Args:
        user_google_email: The user’s Google email address.
        file_id: Drive file ID.
        offset: Character offset to read on from after a truncated result.
        full_content: Return all content from offset onward in one call
            instead of a page of the default size.

    Returns:
        str: The file content as plain text with a metadata header that carries
        the file's version, so a reader paging by offset can tell when it
        changed and restart from offset=0. For images, a ToolResult with that
        text followed by the image as image content.
get_drive_file_download_url tool
Downloads a Google Drive file and saves it to local disk.

    In stdio mode, returns the local file path for direct access.
    In HTTP mode, returns a temporary download URL (valid for 1 hour).
    In stateless mode (no file storage), returns the file itself as an embedded
    resource, up to WORKSPACE_MCP_STATELESS_INLINE_MAX_BYTES (default 10 MiB,
    and never more than WORKSPACE_MCP_MAX_FILE_BYTES when that is set).

    For Google native files (Docs, Sheets, Slides, Drawings), exports to a useful format:
    - Google Docs -> PDF (default) or DOCX if export_format='docx'
    - Google Sheets -> XLSX (default), PDF if export_format='pdf', or CSV if export_format='csv'
    - Google Slides -> PDF (default) or PPTX if export_format='pptx'
    - Google Drawings -> PNG (default), or PDF, JPG or SVG if export_format='pdf', 'jpg' or 'svg'

    For other files, downloads the original file format.

    Args:
        user_google_email: The user's Google email address. Required.
        file_id: The Google Drive file ID to download.
        export_format: Optional export format for Google native files.
                      Options: 'pdf', 'docx', 'xlsx', 'csv', 'pptx', 'png', 'jpg', 'svg'.
                      If not specified, uses sensible defaults (PDF for Docs/Slides, XLSX for Sheets,
                      PNG for Drawings).
                      For Sheets: supports 'csv', 'pdf', or 'xlsx' (default).

    Returns:
        str: File metadata with either a local file path or download URL. In
        stateless mode the same text comes back as a ToolResult that also
        embeds the file; the annotation stays str so the advertised output
        schema is unchanged.
list_drive_items tool
Lists files/folders or shared drive containers, supporting shared drives.
    If `drive_id` is specified, lists items within that shared drive. `folder_id` is then relative to that drive (or use drive_id as folder_id for root).
    If `drive_id` is not specified, lists items from user's "My Drive" and accessible shared drives (if `include_items_from_all_drives` is True).
    Set `resource_type` to "shared_drives" to list shared drive containers instead of folder contents.

    Args:
        user_google_email (str): The user's Google email address. Required.
        folder_id (str): The ID of the Google Drive folder. Defaults to 'root'. For a shared drive, this can be the shared drive's ID to list its root, or a folder ID within that shared drive.
        page_size (int): The maximum number of items to return. Defaults to 100.
        page_token (Optional[str]): Page token from a previous response's nextPageToken to retrieve the next page of results.
        drive_id (Optional[str]): ID of the shared drive. If provided, the listing is scoped to this drive.
        include_items_from_all_drives (bool): Whether items from all accessible shared drives should be included if `drive_id` is not set. Defaults to True.
        corpora (Optional[str]): Corpus to query ('user', 'drive', 'allDrives'). If `drive_id` is set and `corpora` is None, 'drive' is used. If None and no `drive_id`, 'allDrives' is used when `include_items_from_all_drives` is True.
        file_type (Optional[str]): Restrict results to a specific file type. Accepts a friendly
                                   name ('folder', 'document'/'doc', 'spreadsheet'/'sheet',
                                   'presentation'/'slides', 'form', 'drawing', 'pdf', 'shortcut',
                                   'script', 'site', 'jam'/'jamboard') or any raw MIME type
                                   string (e.g. 'application/pdf'). Defaults to None (all types).
        detailed (bool): Whether to include size, modified time, and link in results. Defaults to True.
        order_by (Optional[str]): Sort order. Comma-separated list of sort keys with optional 'desc' modifier.
                                  Valid keys: 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime',
                                  'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime',
                                  'starred', 'viewedByMeTime'. Example: 'modifiedTime desc' or 'folder,modifiedTime desc,name'.
                                  Defaults to None (Drive API default ordering).
        resource_type (str): What to list. Use "items" for folder contents or
                             "shared_drives" for shared drive containers. Defaults to "items".
        query (Optional[str]): Shared drive query used only when resource_type="shared_drives",
                               e.g. "name contains 'Engineering'".
        include_organizers (bool): When resource_type="shared_drives", include principals
                                   with the organizer role. This costs one extra permissions.list
                                   API call per shared drive returned. Defaults to False.

    Returns:
        str: A formatted list of files/folders in the specified folder or shared drives.
             Includes a nextPageToken line when more results are available.
create_drive_folder tool
Creates a new folder in Google Drive, supporting creation within shared drives.

    Args:
        user_google_email (str): The user's Google email address. Required.
        folder_name (str): The name for the new folder.
        parent_folder_id (str): The ID of the parent folder. Defaults to 'root'.
            For shared drives, use a folder ID within that shared drive.

    Returns:
        str: Confirmation message with folder name, ID, and link.
create_drive_file tool
Creates a new file in Google Drive, supporting creation within shared drives.
    Accepts direct text content, inline base64 bytes, or a fileUrl to fetch content from.
    Where local file access is disabled it can instead return an upload URL for the
    caller to PUT file bytes to. With shortcut_target_id it creates a Drive shortcut
    to an existing file or folder instead.
    This stores the supplied bytes without converting them to Google Docs, Sheets, or
    Slides. Use the matching import_to_google_* tool for Google-native conversion.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new file.
        content (Optional[str]): If provided, the content to write to the file.
        folder_id (str): The ID of the parent folder. Defaults to 'root'. For shared drives, this must be a folder ID within the shared drive.
        mime_type (Optional[str]): The MIME type of the file. Defaults to 'text/plain'; required with return_upload_url.
        fileUrl (Optional[str]): If provided, fetches the file content from this URL. Supports http:// and https://; file:// only where local file access is enabled. Where it is disabled, files on the caller's machine go through an upload URL instead (see the upload-URL parameter, if offered).
        base64_content (Optional[str]): Standard base64-encoded file bytes.
        content_mime_type (Optional[str]): MIME type for base64_content uploads.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL for a new file of mime_type instead of creating it from inline content; the caller PUTs the bytes there directly (no Authorization header). Preferred for large or binary files. Not combinable with other content sources. Offered only where local file access is disabled.
        shortcut_target_id (Optional[str]): ID of an existing file or folder. Creates a shortcut named file_name in folder_id that points to it, so the item shows up in a second folder without being copied. Not combinable with content sources; mime_type may be omitted.

    Returns:
        str: Confirmation message of the successful file creation with file link,
            or the resumable upload URL.
import_to_google_doc tool
Imports a file (Markdown, DOCX, TXT, HTML, RTF, ODT) into Google Docs format with automatic conversion.

    Google Drive automatically converts the source file to native Google Docs format,
    preserving formatting like headings, lists, bold, italic, etc.
    Binary sources may be passed directly as base64_content. On a local server a
    file on disk can also be passed by path (preferred for batch operations, so
    callers do not need to load full file contents into their context).

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new Google Doc; the extension is dropped from the title. Without 'source_format', its extension also sets the format of 'content' or 'base64_content' (e.g. 'Notes.md' so Markdown tables are not imported as plain text).
        content (Optional[str]): Text content for text-based formats. Use only for short snippets or content already in memory.
        file_path (Optional[str]): Local file path or file:// URL for any supported format (MD, TXT, HTML, DOCX, ODT, RTF). Appropriate for larger files than content, but file_path may still load the file into memory or perform non-streaming reads. Avoid very large files that could exceed memory or time limits; use streaming/chunked uploads or an alternative API for huge files.
        file_url (Optional[str]): Remote URL to fetch the file from (http/https).
        source_format (Optional[str]): Source format hint ('md', 'markdown', 'docx', 'txt', 'html', 'rtf', 'odt').
                                       Auto-detected from file_name extension if not provided.
        folder_id (str): The ID of the parent folder. Defaults to 'root'.
        base64_content (Optional[str]): Standard base64-encoded bytes for a binary source such as DOCX or ODT.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL instead of ingesting the source here; the caller PUTs the source bytes there directly (no Authorization header) and Drive converts them. Requires source_format; not combinable with other content sources. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with the new Google Doc link, or the resumable upload URL.

    Examples:
        # Import a markdown file from disk (preferred for batch operations)
        import_to_google_doc(file_name="My Doc.md", file_path="/path/to/my-doc.md", source_format="md")

        # Import markdown content directly
        import_to_google_doc(file_name="My Doc.md", content="# Title\\\\n\\\\nHello **world**")

        # Import a local DOCX file
        import_to_google_doc(file_name="Report", file_path="/path/to/report.docx")

        # Import from URL
        import_to_google_doc(file_name="Remote Doc", file_url="https://example.com/doc.md")

        # Get an upload URL and PUT a DOCX to it directly (hosted servers, large files)
        import_to_google_doc(file_name="Report", source_format="docx", return_upload_url=True)
import_to_google_slides tool
Imports a presentation (PPTX, PPT, ODP) into Google Slides format with automatic conversion.

    Google Drive automatically converts the source presentation to native Google Slides format,
    preserving slides, layouts, text, and images.
    Binary sources may be passed directly as base64_content. On a local server a
    file on disk can also be passed by path (preferred for batch operations, so
    callers do not need to load full file contents into their context).

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new Google Slides presentation; the extension is dropped from the title. Without 'source_format', its extension also sets the format of 'base64_content' (e.g. 'Deck.pptx').
        file_path (Optional[str]): Local file path or file:// URL for any supported format (PPTX, PPT, ODP). Appropriate for larger files than content, but file_path may still load the file into memory or perform non-streaming reads. Avoid very large files that could exceed memory or time limits; use streaming/chunked uploads or an alternative API for huge files.
        file_url (Optional[str]): Remote URL to fetch the presentation from (http/https).
        source_format (Optional[str]): Source format hint ('pptx', 'ppt', 'odp').
                                       Auto-detected from file_name extension if not provided.
        folder_id (str): The ID of the parent folder. Defaults to 'root'.
        base64_content (Optional[str]): Standard base64-encoded bytes for a PPTX or ODP source.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL instead of ingesting the source here; the caller PUTs the source bytes there directly (no Authorization header) and Drive converts them. Requires source_format; not combinable with other content sources. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with the new Google Slides link, or the resumable upload URL.

    Examples:
        # Import a local PowerPoint file (preferred for batch operations)
        import_to_google_slides(file_name="Deck", file_path="/path/to/deck.pptx")

        # Import from URL
        import_to_google_slides(file_name="Remote Deck", file_url="https://example.com/deck.pptx")

        # Get an upload URL and PUT a PPTX to it directly (hosted servers, large files)
        import_to_google_slides(file_name="Deck", source_format="pptx", return_upload_url=True)
import_to_google_sheets tool
Imports a spreadsheet (XLSX, XLS, ODS, CSV, TSV) into Google Sheets format with automatic conversion.

    Google Drive automatically converts the source spreadsheet to native Google Sheets format,
    preserving rows, columns, sheets, and values.
    Binary sources may be passed directly as base64_content. On a local server a
    file on disk can also be passed by path (preferred for batch operations, so
    callers do not need to load full file contents into their context).

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name for the new Google Sheets spreadsheet; the extension is dropped from the title. Without 'source_format', its extension also sets the format of 'content' or 'base64_content' (e.g. 'Data.csv').
        content (Optional[str]): Text content for text-based formats (CSV, TSV). Use only for short snippets or content already in memory.
        file_path (Optional[str]): Local file path or file:// URL for any supported format (XLSX, XLS, ODS, CSV, TSV). Appropriate for larger files than content, but file_path may still load the file into memory or perform non-streaming reads. Avoid very large files that could exceed memory or time limits; use streaming/chunked uploads or an alternative API for huge files.
        file_url (Optional[str]): Remote URL to fetch the spreadsheet from (http/https).
        source_format (Optional[str]): Source format hint ('xlsx', 'xls', 'ods', 'csv', 'tsv').
                                       Auto-detected from file_name extension if not provided.
        folder_id (str): The ID of the parent folder. Defaults to 'root'.
        base64_content (Optional[str]): Standard base64-encoded bytes for an XLSX, XLS, or ODS source.
        base64_sha256 (Optional[str]): Expected SHA-256 of decoded base64_content. Recommended for binary payload integrity checks.
        return_upload_url (bool): Return a Google resumable-upload session URL instead of ingesting the source here; the caller PUTs the source bytes there directly (no Authorization header) and Drive converts them. Requires source_format; not combinable with other content sources. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with the new Google Sheets link, or the resumable upload URL.

    Examples:
        # Import a local Excel file (preferred for batch operations)
        import_to_google_sheets(file_name="Budget", file_path="/path/to/budget.xlsx")

        # Import CSV content directly
        import_to_google_sheets(file_name="Data.csv", content="a,b,c\\\\n1,2,3", source_format="csv")

        # Import from URL
        import_to_google_sheets(file_name="Remote Sheet", file_url="https://example.com/data.xlsx")

        # Get an upload URL and PUT an XLSX to it directly (hosted servers, large files)
        import_to_google_sheets(file_name="Budget", source_format="xlsx", return_upload_url=True)
get_drive_file_permissions tool
Gets detailed metadata about a Google Drive file including sharing permissions,
    parent folder IDs, ownership, and lifecycle timestamps.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file to check permissions for.

    Returns:
        str: Detailed file metadata including parents, owners, timestamps, sharing status, and URLs.
check_drive_file_public_access tool
Searches for a file by name and checks if it has public link sharing enabled.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_name (str): The name of the file to check.
        drive_id (Optional[str]): ID of the shared drive to scope the search to. When set, the
                                  underlying files.list call uses corpora='drive' and the given
                                  driveId, which is required to reliably find files that live only
                                  in that shared drive. When None, behaviour is unchanged
                                  (default API corpora applies).

    Returns:
        str: Information about the file's sharing status and whether it can be used in Google Docs.
update_drive_file tool
Updates metadata, properties, and/or content of a Google Drive file.

    Providing new content (inline as ``content``, fetched from ``file_url``, or on a
    local server read from a file path) replaces the file's content in place,
    preserving the existing file ID, sharing, comments, and links.
    For native Google Docs/Sheets/Slides the source is uploaded with its source MIME
    type so the Drive API applies the same format conversion as import_to_google_doc
    (markdown headings, tables, bold, etc.). For any other file (.md, .txt, .pdf, ...)
    there is nothing to convert, so the bytes are written back as-is under the file's
    own MIME type. Metadata and content can be updated in a single call.

    ``mode='append'``/``'prepend'`` splice ``content`` onto the file's existing text
    server-side, so only the new text has to be supplied — no need to send the whole
    file back to rewrite it.

    Drive shortcuts are handled according to the kind of update: supported
    resource-local metadata changes (rename, move, trash, star, description, and
    custom properties) apply to the supplied shortcut, while content replacement
    follows the shortcut and updates its target. To avoid applying metadata to the
    wrong resource, a shortcut call cannot combine content with resource-local
    metadata. Update the shortcut metadata and target content in separate calls.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file to update. Required.
        name (Optional[str]): New name for the file.
        description (Optional[str]): New description for the file.
        mime_type (Optional[str]): New MIME type (note: changing type may require
            content upload). For a shortcut ID, this must accompany content and applies
            to the resolved target.
        add_parents (Optional[str]): Comma-separated folder IDs to add as parents.
        remove_parents (Optional[str]): Comma-separated folder IDs to remove from parents.
        starred (Optional[bool]): Whether to star/unstar the file.
        trashed (Optional[bool]): Whether to move file to/from trash.
        writers_can_share (Optional[bool]): Whether editors can share the file. Pass the
            target ID directly; this cannot be changed on a shortcut resource.
        copy_requires_writer_permission (Optional[bool]): Whether copying requires writer
            permission. Pass the target ID directly; this cannot be changed on a
            shortcut resource.
        properties (Optional[dict]): Custom key-value properties for the file.
        content (Optional[str]): New text content for text-based formats (markdown, TXT, HTML).
        file_path (Optional[str]): Local file path for binary formats (DOCX, ODT). Supports file:// URLs.
        file_url (Optional[str]): Remote http(s) URL to fetch new content from.
        source_format (Optional[str]): Source format hint for conversion
            (md, markdown, docx, txt, html, rtf, odt). Auto-detected when omitted, and
            ignored for non-Google files, which are uploaded without conversion.
            Provide at most one content source.
        mode (str): How to apply the new content — 'replace' (default), 'append', or
            'prepend'. Append/prepend require 'content' and a UTF-8 text file such as
            .md or .txt; a newline is inserted at the seam if neither side has one.
            For native Google Docs use insert_doc_elements, modify_doc_text, or
            find_and_replace_doc, which edit in place instead of rewriting the file.
        return_upload_url (bool): Return a Google resumable-upload session URL to
            PUT the replacement bytes to directly (no Authorization header); any
            metadata changes take effect with the upload. Only with
            mode='replace'; not combinable with another content source. Here
            mime_type names the MIME type of the bytes to be uploaded; on a native
            Google file it is required, names only that, and leaves the file's type
            untouched. Offered only where local file access is disabled.

    Returns:
        str: Confirmation message with details of the updates applied, or the
            resumable upload URL.
get_drive_shareable_link tool
Gets the shareable link for a Google Drive file or folder.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file or folder to get the shareable link for. Required.

    Returns:
        str: The shareable links and current sharing status.
manage_drive_access tool
Consolidated tool for managing Google Drive file and folder access permissions.

    Supports granting, batch-granting, updating, revoking permissions, and
    transferring file ownership -- all through a single entry point.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file or folder. Required.
        action (str): The access management action to perform. Required. One of:
            - "grant": Share with a single user, group, domain, or anyone.
            - "grant_batch": Share with multiple recipients in one call.
            - "update": Modify an existing permission (role or expiration).
            - "revoke": Remove an existing permission.
            - "transfer_owner": Transfer file ownership to another user.
        share_with (Optional[str]): Email address (user/group), domain name (domain),
            or omit for 'anyone'. Used by "grant".
        role (Optional[str]): Permission role -- 'reader', 'commenter', or 'writer'.
            Used by "grant" (defaults to 'reader') and "update".
        share_type (str): Type of sharing -- 'user', 'group', 'domain', or 'anyone'.
            Used by "grant". Defaults to 'user'.
        permission_id (Optional[str]): The permission ID to modify or remove.
            Required for "update" and "revoke" actions.
        recipients (Optional[List[Dict[str, Any]]]): List of recipient objects for
            "grant_batch". Each should have: email (str), role (str, optional),
            share_type (str, optional), expiration_time (str, optional). For domain
            shares use 'domain' field instead of 'email'.
        send_notification (bool): Whether to send notification emails. Defaults to True.
            Used by "grant" and "grant_batch".
        email_message (Optional[str]): Custom notification email message.
            Used by "grant" and "grant_batch".
        expiration_time (Optional[str]): Expiration in RFC 3339 format
            (e.g., "2025-01-15T00:00:00Z"). Used by "grant" and "update".
        allow_file_discovery (Optional[bool]): For 'domain'/'anyone' shares, whether
            the file appears in search. Used by "grant".
        new_owner_email (Optional[str]): Email of the new owner.
            Required for "transfer_owner".
        move_to_new_owners_root (bool): Move file to the new owner's My Drive root.
            Defaults to False. Used by "transfer_owner".

    Returns:
        str: Confirmation with details of the permission change applied.
copy_drive_file tool
Creates a copy of an existing Google Drive file.

    This tool copies the template document to a new location with an optional new name.
    The copy maintains all formatting and content from the original file.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file to copy. Required.
        new_name (Optional[str]): New name for the copied file. If not provided, uses "Copy of [original name]".
        parent_folder_id (str): The ID of the folder where the copy should be created. Defaults to 'root' (My Drive).
        copy_comments (bool): Copy open comments and suggestions (Docs/Sheets/Slides only). Defaults to False.

    Returns:
        str: Confirmation message with details of the copied file and its link.
set_drive_file_permissions tool
Sets file-level sharing settings and controls link sharing for a Google Drive file or folder.

    This is a high-level tool for the most common permission changes. Use this to toggle
    "anyone with the link" access or configure file-level sharing behavior. For managing
    individual user/group permissions, use share_drive_file or update_drive_permission instead.

    Args:
        user_google_email (str): The user's Google email address. Required.
        file_id (str): The ID of the file or folder. Required.
        link_sharing (Optional[str]): Control "anyone with the link" access for the file.
            - "off": Disable "anyone with the link" access for this file.
            - "reader": Anyone with the link can view.
            - "commenter": Anyone with the link can comment.
            - "writer": Anyone with the link can edit.
        writers_can_share (Optional[bool]): Whether editors can change permissions and share.
            If False, only the owner can share. Defaults to None (no change).
        copy_requires_writer_permission (Optional[bool]): Whether viewers and commenters
            are prevented from copying, printing, or downloading. Defaults to None (no change).

    Returns:
        str: Summary of all permission changes applied to the file.
create_form tool
Create a new form using the title given in the provided form message in the request.

    Args:
        user_google_email (str): The user's Google email address. Required.
        title (str): The title of the form.
        description (Optional[str]): The description of the form.
        document_title (Optional[str]): The document title (shown in browser tab).

    Returns:
        str: Confirmation message with form ID and edit URL.
get_form tool
Get a form.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form to retrieve.

    Returns:
        str: Form details including title, description, questions, and URLs.
set_publish_settings tool
Updates the publish settings of a form.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form to update publish settings for.
        is_published (bool): Whether the form is published and visible to responders. Defaults to True.
        is_accepting_responses (bool): Whether the form accepts responses. Only takes effect when the form is published. Defaults to True.

    Returns:
        str: Confirmation message of the successful publish settings update.
get_form_response tool
Get one response from the form.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form.
        response_id (str): The ID of the response to retrieve.

    Returns:
        str: Response details including answers and metadata.
list_form_responses tool
List a form's responses.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form.
        page_size (int): Maximum number of responses to return. Defaults to 10.
        page_token (Optional[str]): Token for retrieving next page of results.

    Returns:
        str: List of responses with basic details and pagination info.
batch_update_form tool
Apply batch updates to a Google Form.

    Supports adding, updating, and deleting form items, as well as updating
    form metadata and settings. This is the primary method for modifying form
    content after creation.

    Args:
        user_google_email (str): The user's Google email address. Required.
        form_id (str): The ID of the form to update.
        requests (List[Dict[str, Any]]): List of update requests to apply.
            Supported request types:
            - createItem: Add a new question or content item
            - updateItem: Modify an existing item
            - deleteItem: Remove an item
            - moveItem: Reorder an item
            - updateFormInfo: Update form title/description
            - updateSettings: Modify form settings (e.g., quiz mode)

    Returns:
        str: Details about the batch update operation results.
search_gmail_messages tool
Searches messages in a user's Gmail account based on a query.
    Returns both Message IDs and Thread IDs for each found message, along with Gmail web interface links for manual verification.
    Supports pagination via page_token parameter.

    Args:
        query (str): The search query. Supports standard Gmail search operators.
            Results include drafts unless the query excludes them (e.g. in:sent or -in:drafts).
        user_google_email (str): The user's Google email address. Required.
        page_size (int): The maximum number of messages to return. Defaults to 10.
        page_token (Optional[str]): Token for retrieving the next page of results. Use the next_page_token from a previous response.
        include_headers (bool): If True, also fetch each message's metadata and include
            Subject, From, Date and label IDs (e.g. DRAFT, SENT) per result. Costs one
            metadata get per result, grouped into HTTP batches of up to 10, plus retries
            for transient failures.
            Defaults to False (output unchanged from prior versions).

    Returns:
        str: LLM-friendly structured results with Message IDs, Thread IDs, and clickable Gmail web interface URLs for each found message.
        With include_headers=True, each result also includes Subject, From, Date and Labels.
        Includes pagination token if more results are available.
get_gmail_message_content tool
Retrieves the full content (subject, sender, recipients, body) of a specific Gmail message.

    Set page_offset=0 to read the complete rendered body, excluding attachments and
    attached messages, as JSON pages of at most page_size characters. Follow
    next_offset until complete=true, passing body_sha256 as expected_sha256 and
    keeping body_format and include_links unchanged.

    Bodies are returned inline and truncated at 20,000 characters. Set full=True to
    get the complete, untruncated message instead: it is exported to storage and the
    response carries a short-lived download URL (HTTP transport) or file path (stdio
    transport) rather than the body, so large messages never stream through the model
    context. Stateless deployments without GCS staging have no storage, so there
    full=True returns the untruncated body inline; with GCS staging configured it
    returns a signed download URL like any other HTTP deployment.

    Args:
        message_id (str): The unique ID of the Gmail message to retrieve.
        user_google_email (str): The user's Google email address. Required.
        body_format (Literal["text", "html", "raw"]): Body output format (only applies
            when format='full').
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches the full raw MIME message and returns the base64url-decoded content.
        full (bool): When True, write the untruncated message to storage and
            return its URL/path instead of the body. body_format selects the exported
            file type: "raw" saves the byte-exact RFC 5322 message as .eml, "html"
            saves the raw HTML body, "text" saves the plaintext body. The "html"/"text"
            exports are re-encoded as UTF-8 from the declared charset, so prefer "raw" when
            byte-exact fidelity matters. In stateless mode without GCS staging there is
            no storage to write to, so the untruncated content is returned inline
            instead; with GCS staging it is saved and returned as a signed URL.
        format (Literal["full", "metadata"]): Message format. "full" (default) includes
            the body and attachments, "metadata" only headers.
        include_headers (bool): When False, omit the Subject/From/To/Date header
            summary (attached messages' too), and with full=True name the export
            after the message ID. Requires format='full'; body_format='raw' is only
            allowed when the raw message is exported to a file.
        include_links (bool): Append the HTML body's http(s) links missing from the text output.
        page_offset (int): Start position in the complete rendered body. Requires
            format="full", full=False, and body_format="text" or "html".
        page_size (int): Maximum body characters per page, between 1 and 20,000.
        expected_sha256 (str): Optional previous body_sha256; rejects changed content.

    Returns:
        str: The message details including subject, sender, date, Message-ID, recipients
            (To, Cc), and body content — or, when full=True, the saved file's download
            URL or path in place of the body (inline only in stateless mode without
            GCS staging).
get_gmail_messages_content_batch tool
Retrieves the content of multiple Gmail messages in a single batch request.
    Supports up to 25 messages per batch to prevent SSL connection exhaustion.

    Args:
        message_ids (List[str]): List of Gmail message IDs to retrieve; fetched in batches of 25.
        user_google_email (str): The user's Google email address. Required.
        format (Literal["full", "metadata"]): Message format. "full" includes body, "metadata" only headers.
        body_format (Literal["text", "html", "raw"]): Body output format (only applies when format='full').
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches the full raw MIME message and returns the base64url-decoded content.
        include_links (bool): Append the HTML body's http(s) links missing from the text output.

    Returns:
        str: A formatted list of message contents including subject, sender, date, Message-ID, recipients (To, Cc), and body (if full format).
get_gmail_attachment_content tool
Downloads an email attachment and saves it to local disk.

    In stdio mode, returns the local file path for direct access.
    In HTTP mode, returns a temporary download URL (valid for 1 hour).
    May re-fetch message metadata to resolve filename and MIME type.

    Args:
        message_id (str): The ID of the Gmail message containing the attachment.
        attachment_id (str): The ID of the attachment to download.
        user_google_email (str): The user's Google email address. Required.
        return_base64 (bool): When True, includes the full attachment as a
            standard base64 string in the response (in addition to any file
            path or download URL). Useful for sandboxed clients that cannot
            reach localhost download URLs or the MCP server's local file
            paths (e.g. containerized agents with network allowlists). The
            returned base64 uses the standard alphabet, so it can be passed
            directly to tools like ``draft_gmail_message`` that expect
            standard (not URL-safe) base64. Default False preserves the
            existing behavior and response size.
        attachment_index (Optional[int]): Zero-based attachment position from
            the message-content response. Lets the server resolve Gmail's
            refreshed attachment IDs against current metadata before every
            download, selecting the current attachment ID, filename and MIME type.

    Returns:
        str: Attachment metadata with either a local file path or download URL,
            optionally followed by a base64 content block when
            ``return_base64=True``.
send_gmail_message tool
Sends an email using the user's Gmail account. Supports new emails, replies, and
    forwards, with optional attachments. Supports Gmail's "Send As" feature to send
    from configured alias addresses.

    To forward an existing message, pass forward_message_id. The original subject,
    body (quoted with a "Forwarded message" header), and attachments are carried over.
    In forward mode, body (if any) is prepended as a note and subject is optional.
    Threading, reply, and signature options do not apply when forwarding.

    THIS TOOL SENDS IMMEDIATELY AND CANNOT SCHEDULE. Gmail's REST API exposes no
    send-time parameter; Schedule send is a web-UI feature with no API equivalent,
    so no argument to this tool can defer delivery. Never tell a user a message
    was scheduled. For "prepare now, deliver later", create a draft with
    draft_gmail_message. An external scheduler must retain the message data to
    create and send a new message via send_gmail_message at the chosen time, or
    call users.drafts.send with the draft ID returned by draft_gmail_message.
    Alternatively, let the user schedule that draft in the Gmail UI.

    Args:
        to (str): Recipient email address.
        subject (str): Email subject. Required for a new message. Optional when replying
            with thread_id (inherits the parent message's subject) or forwarding (then
            defaults to 'Fwd: <original subject>').
        body (str): Email body content. Required unless forwarding (then an optional prepended note).
        body_format (Literal['plain', 'html']): Body format (and prepended note format when forwarding). Defaults to 'plain'.
        forward_message_id (Optional[str]): Gmail message ID to forward. When set, the tool forwards that message.
        include_forwarded_attachments (bool): Whether to carry over the original attachments when forwarding. Defaults to True.
        attachments (Optional[List[Dict[str, str]]]): Optional list of attachments. Each dict can contain:
            Option 1 - File path (auto-encodes):
              - 'path' (required): File path to attach
              - 'filename' (optional): Override filename
              - 'mime_type' (optional): Override MIME type (auto-detected if not provided)
            Option 2 - Base64 content:
              - 'content' (required): Standard base64-encoded file content (not urlsafe)
              - 'filename' (required): Name of the file
              - 'mime_type' (optional): MIME type (defaults to 'application/octet-stream')
        cc (Optional[str]): Optional CC email address.
        bcc (Optional[str]): Optional BCC email address.
        from_name (Optional[str]): Optional sender display name. If provided, the From header will be formatted as 'Name <email>'.
        from_email (Optional[str]): Optional 'Send As' alias email address. The alias must be
            configured in Gmail settings (Settings > Accounts > Send mail as). If not provided,
            the email will be sent from the authenticated user's primary email address.
        user_google_email (str): The user's Google email address. Required for authentication.
        thread_id (Optional[str]): Optional Gmail thread ID to reply within. When
            in_reply_to is omitted, replies to the latest non-draft, non-trash message
            with an RFC Message-ID.
        in_reply_to (Optional[str]): Optional RFC Message-ID to explicitly reply to
            a specific message. Omit to reply to the latest eligible message.
        references (Optional[str]): Optional RFC Message-ID ancestry chain. Normally
            omit when thread_id is provided; the chain is derived automatically.
        include_signature (bool): Whether to append Gmail signature HTML from send-as settings.
            When include_signature is true and Gmail signature retrieval fails for benign reasons
            (e.g., missing gmail.settings.basic scope), the send proceeds without a signature.
            Non-benign failures such as quota/rate-limit or API errors raise ToolError and abort
            the send.
        quote_original (bool): Whether to append the message being replied to as a quoted
            original. Only has an effect when thread_id is provided.
        reply_all (bool): Whether to derive reply-all recipients from the thread: To = the
            sender being replied to, Cc = the other participants, excluding the authenticated
            account and from_email. Requires thread_id. Explicit to/cc win over the derived
            values; when cc is omitted, the sender being replied to is added to the derived Cc
            unless they are already in To (so an explicit 'to' that redirects the reply still
            keeps them on it).
        priority (str): 'high' or 'low' adds priority headers. Defaults to 'normal'.

    Returns:
        str: Confirmation message with the sent email's message ID.

    Examples:
        # Send a new email
        send_gmail_message(to="[email protected]", subject="Hello", body="Hi there!")

        # Send with a custom display name
        send_gmail_message(to="[email protected]", subject="Hello", body="Hi there!", from_name="John Doe")

        # Send an HTML email
        send_gmail_message(
            to="[email protected]",
            subject="Hello",
            body="<strong>Hi there!</strong>",
            body_format="html"
        )

        # Send from a configured alias (Send As)
        send_gmail_message(
            to="[email protected]",
            subject="Business Inquiry",
            body="Hello from my business address...",
            from_email="[email protected]"
        )

        # Send an email with CC and BCC
        send_gmail_message(
            to="[email protected]",
            cc="[email protected]",
            bcc="[email protected]",
            subject="Project Update",
            body="Here's the latest update..."
        )

        # Send an email with attachments (using file path)
        send_gmail_message(
            to="[email protected]",
            subject="Report",
            body="Please see attached report.",
            attachments=[{
                "path": "/path/to/report.pdf"
            }]
        )

        # Send an email with attachments (using base64 content)
        send_gmail_message(
            to="[email protected]",
            subject="Report",
            body="Please see attached report.",
            attachments=[{
                "filename": "report.pdf",
                "content": "JVBERi0xLjQK...",  # base64 encoded PDF
                "mime_type": "application/pdf"
            }]
        )

        # Send a reply
        send_gmail_message(
            to="[email protected]",
            subject="Re: Meeting tomorrow",
            body="Thanks for the update!",
            thread_id="thread_123"
        )

        # Send a reply-all with the original quoted, deriving headers and
        # recipients from the thread
        send_gmail_message(
            subject="Re: Meeting tomorrow",
            body="Thanks for the update!",
            thread_id="thread_123",
            reply_all=True,
            quote_original=True
        )

        # Forward a message with a note
        send_gmail_message(
            to="[email protected]",
            forward_message_id="abc123",
            body="FYI - see below."
        )

        # Forward without the original attachments
        send_gmail_message(
            to="[email protected]",
            forward_message_id="abc123",
            include_forwarded_attachments=False
        )
draft_gmail_message tool
Creates a draft email in the user's Gmail account. Supports new, reply, and forward
    drafts with optional attachments. Supports Gmail's "Send As" feature to draft from
    configured alias addresses.

    To save a forward as a draft for review, pass forward_message_id. The original
    subject, body (quoted with a "Forwarded message" header), and attachments are
    carried over. In forward mode, body (if any) is prepended as a note, subject is
    optional, and threading, reply, and signature options do not apply.

    SCHEDULED SEND IS NOT AVAILABLE. Gmail's REST API exposes no send-time
    parameter; the Schedule send feature is web-UI only, and a message cannot be
    placed in the Scheduled folder through the API. Do not claim a message was
    scheduled. To deliver at a chosen time, create a draft with
    draft_gmail_message. An external scheduler must retain the message data to
    create and send a new message via send_gmail_message then, or call
    users.drafts.send with the draft ID returned by draft_gmail_message.
    Alternatively, let the user schedule the draft in the Gmail UI.

    Args:
        user_google_email (str): The user's Google email address. Required for authentication.
        subject (Optional[str]): Email subject. Required for a new draft. Optional when
            replying with thread_id (inherits the parent message's subject) or forwarding
            (then defaults to 'Fwd: <original subject>').
        body (Optional[str]): Email body. Required unless forwarding (then an optional prepended note).
        body_format (Literal['plain', 'html']): Email body format. Defaults to 'plain'.
        forward_message_id (Optional[str]): Gmail message ID to forward. When set, the draft is a forward of that message.
        include_forwarded_attachments (bool): Whether to carry over the original attachments when forwarding. Defaults to True.
        to (Optional[str]): Optional recipient email address. Can be left empty for drafts.
        cc (Optional[str]): Optional CC email address.
        bcc (Optional[str]): Optional BCC email address.
        from_name (Optional[str]): Optional sender display name. If provided, the From header will be formatted as 'Name <email>'.
        from_email (Optional[str]): Optional 'Send As' alias email address. The alias must be
            configured in Gmail settings (Settings > Accounts > Send mail as). If not provided,
            the draft uses the account's default Send As address, then the primary or first
            usable Send-As entry, falling back to the authenticated user's email when Gmail
            returns no usable entry or settings access is not authorized.
        thread_id (Optional[str]): Optional Gmail thread ID to reply within. When
            in_reply_to is omitted, replies to the latest non-draft, non-trash message
            with an RFC Message-ID.
        in_reply_to (Optional[str]): Optional RFC Message-ID to explicitly reply to
            a specific message. Omit to reply to the latest eligible message.
        references (Optional[str]): Optional RFC Message-ID ancestry chain. Normally
            omit when thread_id is provided; the chain is derived automatically.
        attachments (List[Dict[str, str]]): Optional list of attachments. Each dict can contain:
            Option 1 - File path (auto-encodes):
              - 'path' (required): File path to attach
              - 'filename' (optional): Override filename
              - 'mime_type' (optional): Override MIME type (auto-detected if not provided)
            Option 2 - Base64 content:
              - 'content' (required): Standard base64-encoded file content (not urlsafe)
              - 'filename' (required): Name of the file
              - 'mime_type' (optional): MIME type (defaults to 'application/octet-stream')
        include_signature (bool): Whether to append Gmail signature HTML from send-as settings.
            When include_signature is true and Gmail signature retrieval fails for benign reasons
            (e.g., missing settings authorization), the draft proceeds with the requested or
            authenticated sender and without a signature.
            Non-benign failures such as quota/rate-limit or API errors raise ToolError and abort
            the draft.
        quote_original (bool): Whether to include the original message as a quoted reply.
            Only has an effect when thread_id is provided. When enabled, fetches the
            original message and appends it below the signature. Defaults to False.
        reply_all (bool): Whether to derive reply-all recipients from the thread: To = the
            sender being replied to, Cc = the other participants, excluding the authenticated
            account and from_email. Requires thread_id. Explicit to/cc win over the derived
            values; when cc is omitted, the sender being replied to is added to the derived Cc
            unless they are already in To.
        priority (str): 'high' or 'low' adds priority headers. Defaults to 'normal'.

    Returns:
        str: Confirmation message with the created draft's ID.

    Examples:
        # Create a new draft
        draft_gmail_message(subject="Hello", body="Hi there!", to="[email protected]")

        # Create a draft from a configured alias (Send As)
        draft_gmail_message(
            subject="Business Inquiry",
            body="Hello from my business address...",
            to="[email protected]",
            from_email="[email protected]"
        )

        # Create a plaintext draft with CC and BCC
        draft_gmail_message(
            subject="Project Update",
            body="Here's the latest update...",
            to="[email protected]",
            cc="[email protected]",
            bcc="[email protected]"
        )

        # Create a HTML draft with CC and BCC
        draft_gmail_message(
            subject="Project Update",
            body="<strong>Hi there!</strong>",
            body_format="html",
            to="[email protected]",
            cc="[email protected]",
            bcc="[email protected]"
        )

        # Create a reply draft in plaintext
        draft_gmail_message(
            subject="Re: Meeting tomorrow",
            body="Thanks for the update!",
            to="[email protected]",
            thread_id="thread_123"
        )

        # Create a reply draft in HTML
        draft_gmail_message(
            subject="Re: Meeting tomorrow",
            body="<strong>Thanks for the update!</strong>",
            body_format="html",
            to="[email protected]",
            thread_id="thread_123"
        )

        # Save a forward (with the original attachments) as a draft for review
        draft_gmail_message(
            to="[email protected]",
            forward_message_id="abc123",
            body="FYI - see below."
        )
get_gmail_thread_content tool
Retrieves the complete content of a Gmail conversation thread, including all messages.

    Optionally also returns structured ownership analysis so a caller can
    determine who sent the last message and who owes whom a response without
    re-parsing the formatted string or making a second tool call.

    Args:
        thread_id (str): The unique ID of the Gmail thread to retrieve.
        user_google_email (str): The user's Google email address. Required.
        body_format (Literal["text", "html", "raw"]): Body output format.
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches each message's full raw MIME content and returns the base64url-decoded body.
        include_analysis (bool): When True, returns a dict containing both the
            formatted thread content and structured ownership analysis. When
            False (default), returns the formatted content string (existing
            behavior, unchanged).
        include_links (bool): Append the HTML body's http(s) links missing from the text output.

    Returns:
        str: When `include_analysis=False` (default). The complete thread
        content with all messages formatted for reading.

        Dict[str, Any]: When `include_analysis=True`. A dict with keys
            "content" (str) and "analysis" (dict). See
            `_analyze_thread_ownership_impl` for the analysis schema.
get_gmail_threads_content_batch tool
Retrieves the content of multiple Gmail threads in a single batch request.
    Supports up to 25 threads per batch to prevent SSL connection exhaustion.

    Args:
        thread_ids (List[str]): A list of Gmail thread IDs to retrieve. The function will automatically batch requests in chunks of 25.
        user_google_email (str): The user's Google email address. Required.
        body_format (Literal["text", "html", "raw"]): Body output format.
            "text" (default) returns plaintext (HTML converted to text as fallback).
            "html" returns the raw HTML body as-is without conversion.
            "raw" fetches each message's full raw MIME content and returns the base64url-decoded body.
        include_links (bool): Append the HTML body's http(s) links missing from the text output.

    Returns:
        str: A formatted list of thread contents with separators.
list_gmail_labels tool
Lists labels in the user's Gmail account.

    Args:
        user_google_email (str): The user's Google email address. Required.
        prefix (Optional[str]): Return only labels whose name starts with this
            exact (case-sensitive) string. users.labels.list accepts no filter,
            so the full list is fetched and narrowed here: this shrinks what the
            caller receives, not the API call.
        compact (bool): Return minimal JSON {"count", "labels": [{"id", "name"}]}
            sorted by name, instead of the formatted text list. For callers
            that parse the result, e.g. a label cache refresh.
        include_system (bool): Include Gmail system labels (INBOX, SENT, ...).
            Set False to return user labels only.

    Returns:
        str: A formatted list of labels, or minimal JSON when compact=True.
manage_gmail_label tool
Manages Gmail labels: create, update, or delete labels.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (Literal["create", "update", "delete"]): Action to perform on the label.
        name (Optional[str]): Label name. Required for create, optional for update.
        label_id (Optional[str]): Label ID. Required for update and delete operations.
        label_list_visibility (Optional[Literal["labelShow", "labelShowIfUnread", "labelHide"]]): Whether the label is shown in the label list. Defaults to "labelShow" on create. On update, omitting it keeps the label's current setting.
        message_list_visibility (Optional[Literal["show", "hide"]]): Whether the label's messages are shown in the message list. Defaults to "show" on create. On update, omitting it keeps the label's current setting.
        background_color (Optional[str]): Label background color as a hex string, e.g. "#fb4c2f". Set together with text_color; Gmail requires both. Gmail accepts only its own palette, and an unsupported value is rejected before the request. Colors apply to user labels, not system labels.
        text_color (Optional[str]): Label text color as a hex string, e.g. "#ffffff". Set together with background_color. Same palette. On update, omitting both keeps the label's current color.
        clear_color (bool): On update, remove the label's current color. Cannot be combined with background_color or text_color.

    Returns:
        str: Confirmation message of the label operation.
list_gmail_filters tool
Lists all Gmail filters configured in the user's mailbox.

    Args:
        user_google_email (str): The user's Google email address. Required.

    Returns:
        str: A formatted list of filters with their criteria and actions.
manage_gmail_filter tool
Manages Gmail filters: create, delete, update, and apply to existing mail.

    - update: Gmail has no filter update API, so the filter is recreated (new
      one first, then the old one is deleted) and its ID changes. A passed
      criteria or filter_action replaces that whole object; omit one to keep
      the old filter's.
    - apply: runs a filter's label actions on mail ALREADY in the mailbox
      (Gmail filters only act on new mail). Only matching messages change,
      not whole conversations as in the web UI. Use filter_id, or criteria +
      filter_action for an ad-hoc run. Forwarding is never applied. Use
      dry_run=true first to see the search query and the match count.
      Needs the gmail.modify scope in addition to gmail.settings.basic.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): "create", "delete", "update" or "apply".
        criteria (Optional[Dict[str, Any]]): Filter criteria object (required for create; optional for update/apply).
        filter_action (Optional[Dict[str, Any]]): Filter action object (required for create; optional for update/apply). Named 'filter_action' to avoid shadowing the 'action' parameter.
        filter_id (Optional[str]): ID of the filter (required for delete and update; optional for apply).
        dry_run (bool): apply only: count matches without changing anything.
        max_messages (int): apply only: safety cap on messages changed (default 5000).

    Returns:
        str: Confirmation message with filter details.
modify_gmail_message_labels tool
Adds or removes labels from a Gmail message.
    To archive an email, remove the INBOX label.
    To delete an email, add the TRASH label.

    Args:
        user_google_email (str): The user's Google email address. Required.
        message_id (str): The ID of the message to modify.
        add_label_ids (Optional[List[str]]): List of label IDs to add to the message.
        remove_label_ids (Optional[List[str]]): List of label IDs to remove from the message.

    Returns:
        str: Confirmation message of the label changes applied to the message.
batch_modify_gmail_message_labels tool
Adds or removes labels on many Gmail messages, or on every message of whole
    conversations via thread_ids.

    message_ids are sent in one users.messages.batchModify call (Gmail accepts
    up to 1000 ids per call). That endpoint returns no per-message result and
    silently ignores ids it does not recognise, so by default the messages are
    read back afterwards to report which ids actually changed.

    thread_ids are modified one at a time with users.threads.modify, e.g.
    archive a conversation with remove_label_ids=["INBOX"] or mark it read with
    remove_label_ids=["UNREAD"]. Each thread reports its own outcome.
    message_ids and thread_ids can be combined; at least one is required, as is
    at least one of add_label_ids or remove_label_ids.

    Args:
        user_google_email (str): The user's Google email address. Required.
        message_ids (Optional[List[str]]): Message IDs to modify.
        add_label_ids (Optional[List[str]]): Label IDs to add.
        remove_label_ids (Optional[List[str]]): Label IDs to remove.
        verify (bool): Read message_ids back and report per-id outcomes, at the
            cost of one extra read per id (batched 25 at a time). Set False for
            very large sweeps where an unverified result is acceptable. Has no
            effect on thread_ids, which always report per thread.
        thread_ids (Optional[List[str]]): Thread (conversation) IDs to modify.

    Returns:
        str: Per-id outcomes for message_ids (applied, unchanged, not found, or
            unverified) and per-thread outcomes for thread_ids.
search_custom tool
Performs a search using Google Custom Search JSON API.

    Args:
        user_google_email (str): The user's Google email address. Required.
        q (str): The search query. Required.
        num (int): Number of results to return (1-10). Defaults to 10.
        start (int): The index of the first result to return (1-based). Defaults to 1.
        safe (Literal["active", "moderate", "off"]): Safe search level. Defaults to "off".
        search_type (Optional[Literal["image"]]): Search for images if set to "image".
        site_search (Optional[str]): Restrict search to a specific site/domain.
        site_search_filter (Optional[Literal["e", "i"]]): Exclude ("e") or include ("i") site_search results.
        date_restrict (Optional[str]): Restrict results by date (e.g., "d5" for past 5 days, "m3" for past 3 months).
        file_type (Optional[str]): Filter by file type (e.g., "pdf", "doc").
        language (Optional[str]): Language code for results (e.g., "lang_en").
        country (Optional[str]): Country code for results (e.g., "countryUS").
        sites (Optional[List[str]]): List of sites/domains to restrict search to (e.g., ["example.com", "docs.example.com"]). When provided, results are limited to these sites.

    Returns:
        str: Formatted search results including title, link, and snippet for each result.
get_search_engine_info tool
Retrieves metadata about a Programmable Search Engine.

    Args:
        user_google_email (str): The user's Google email address. Required.

    Returns:
        str: Information about the search engine including its configuration and available refinements.
list_spreadsheets tool
Lists spreadsheets from Google Drive that the user has access to.

    Args:
        user_google_email (str): The user's Google email address. Required.
        max_results (int): Maximum number of spreadsheets to return. Defaults to 25.
        page_token (Optional[str]): Page token from a previous response's nextPageToken to retrieve the next page of results.
        corpora (Optional[str]): Corpus to search ('user', 'domain', 'drive', 'allDrives').
            Defaults to 'drive' when drive_id is set, otherwise 'allDrives'.
        drive_id (Optional[str]): Shared drive ID to search.

    Returns:
        str: A formatted list of spreadsheet files (name, ID, modified time).
             Includes a nextPageToken line when more results are available.
get_spreadsheet_info tool
Gets information about a specific spreadsheet including its sheets.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet to get info for. Required.

    Returns:
        str: Formatted spreadsheet information including title, locale, and sheets list.
read_sheet_values tool
Reads values from a specific range in a Google Sheet, one line per row:
    the sheet row number, then the row's cells separated by tabs.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        range_name (str): The range to read (e.g., "Sheet1!A1:D10", "A1:D10").
            Defaults to "A1:Z1000". Open-ended or oversized ranges are clamped to
            at most 1000 rows before the Sheets API request to bound memory use.
        include_hyperlinks (bool): If True, also fetch hyperlink metadata for the range.
            Defaults to False to avoid expensive includeGridData requests.
        include_notes (bool): If True, also fetch cell notes for the range.
            Defaults to False to avoid expensive includeGridData requests.
        include_formulas (bool): If True, also fetch raw formula strings for cells that
            contain formulas. Useful for identifying cross-sheet references before writing
            back to a range. Defaults to False to avoid an extra API request.
        include_smart_chips (bool): If True, also fetch smart chips metadata (Drive files/folders
            and People chips) for the range. Defaults to False to avoid expensive includeGridData requests.
        include_validation (bool): If True, also fetch data validation rules (dropdowns,
            checkboxes, ranges, custom formulas) for the range. Defaults to False to avoid
            expensive includeGridData requests.

    Returns:
        str: The formatted values, with trailing empty cells dropped.
modify_sheet_values tool
Modifies values in a specific range of a Google Sheet - can write, update, or clear values,
    insert Smart Chips (Drive files/folders or People), or copy another range into it.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        range_name (str): The range to modify (e.g., "Sheet1!A1:D10", "A1:D10"). Required.
        values (Optional[Union[str, List[List[str]]]]): 2D array of values to write/update. Can be a JSON string or Python list. Required unless clear_values=True or chips is provided.
        value_input_option (str): How to interpret input values ("RAW" or "USER_ENTERED"). Defaults to "USER_ENTERED".
        clear_values (bool): If True, clears the range instead of writing values. Defaults to False.
        chips (Optional[Union[str, dict, List[Any]]]): Smart chip(s) to insert instead of values:
            - A single URL or email string for a single cell (e.g., "https://drive.google.com/drive/folders/123", "[email protected]").
            - A list of URLs or emails for a single cell (multiple chips) or across cells (e.g., ["https://...", "https://..."]).
            - A 2D list of URLs/emails matching a grid range. For a single-row or single-column
              range, each inner list is instead the chips for one cell (e.g., [["[email protected]", "[email protected]"]]
              puts both chips in the first cell of "A1:C1").
            - A dict or list of dicts with explicit properties (e.g., {"type": "drive", "uri": "..."}, {"type": "person", "email": "..."}).
            - A JSON-encoded string representing any of the above formats.
        chip_type (Optional[str]): Explicit chip type if passing raw strings in chips: "drive" (default for URLs/IDs) or "person" (default for emails).
        source_range (Optional[str]): A1 range in the same spreadsheet to copy into range_name, like the UI copy and
            paste: relative formula references shift and formatting comes along. Both ranges must be A1 notation (not
            named ranges); one without a sheet name uses the first sheet. range_name may be just the top-left cell
            (e.g., copy "Sheet1!A29:AO29" to "Sheet1!A30"). Use instead of values, chips, or clear_values.
        paste_type (str): What source_range pastes: "PASTE_NORMAL" (values, formulas, formatting), "PASTE_VALUES",
            "PASTE_FORMAT", "PASTE_NO_BORDERS", "PASTE_FORMULA", "PASTE_DATA_VALIDATION", or
            "PASTE_CONDITIONAL_FORMATTING". Defaults to "PASTE_NORMAL".

    Returns:
        str: Confirmation message of the successful modification operation.
format_sheet_range tool
Applies formatting to a range: colors, number formats, text wrapping,
    alignment, text styling, cell merging/unmerging, borders, and dropdown lists.

    Colors accept hex strings (#RRGGBB). Number formats follow Sheets types
    (e.g., NUMBER, CURRENCY, DATE, PERCENT). If no sheet name is provided,
    the first sheet is used.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        range_name (str): A1-style range (optionally with sheet name). Required.
        background_color (Optional[str]): Hex background color (e.g., "#FFEECC").
        text_color (Optional[str]): Hex text color (e.g., "#000000").
        number_format_type (Optional[str]): Sheets number format type (e.g., "DATE").
        number_format_pattern (Optional[str]): Custom pattern for the number format.
        wrap_strategy (Optional[str]): Text wrap strategy - WRAP (wrap text within
            cell), CLIP (clip text at cell boundary), or OVERFLOW_CELL (allow text
            to overflow into adjacent empty cells).
        horizontal_alignment (Optional[str]): Horizontal text alignment - LEFT,
            CENTER, or RIGHT.
        vertical_alignment (Optional[str]): Vertical text alignment - TOP, MIDDLE,
            or BOTTOM.
        bold (Optional[bool]): Whether to apply bold formatting.
        italic (Optional[bool]): Whether to apply italic formatting.
        font_size (Optional[int]): Font size in points.
        merge_cells (Optional[bool]): True merges the range, False unmerges it.
            Merging keeps only the top-left value of each merged group.
        merge_type (Optional[str]): MERGE_ALL (default), MERGE_COLUMNS, or
            MERGE_ROWS. Setting it implies merge_cells=True.
        borders (Optional[str]): Which borders to draw, comma-separated: all,
            outer, inner, top, bottom, left, right, inner_horizontal,
            inner_vertical (e.g., "outer" or "bottom,inner_horizontal").
            "none" removes every border in the range.
        border_style (Optional[str]): SOLID (default), SOLID_MEDIUM, SOLID_THICK,
            DASHED, DOTTED, or DOUBLE. Requires borders.
        border_color (Optional[str]): Hex border color (default black). Requires
            borders.
        dropdown_values (Optional[List[str]]): Turns every cell in the range into
            a dropdown offering these values (e.g., ["open", "done"]).
        dropdown_strict (Optional[bool]): With dropdown_values: reject other
            input (default True) or only show a warning (False).
        clear_dropdown (Optional[bool]): Remove all data validation from the
            range: dropdowns, but also checkboxes and other validation rules.

    Returns:
        str: Confirmation of the applied formatting.
manage_conditional_formatting tool
Manages conditional formatting rules on a Google Sheet. Supports adding,
    updating, and deleting conditional formatting rules via a single tool.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        action (str): The operation to perform. Must be one of "add", "update",
            or "delete".
        range_name (Optional[str]): A1-style range (optionally with sheet name).
            Required for "add". Optional for "update" (preserves existing ranges
            if omitted). Not used for "delete".
        condition_type (Optional[str]): Sheets condition type (e.g., NUMBER_GREATER,
            TEXT_CONTAINS, DATE_BEFORE, CUSTOM_FORMULA). Required for "add".
            Optional for "update" (preserves existing type if omitted).
        condition_values (Optional[Union[str, List[Union[str, int, float]]]]): Values
            for the condition; accepts a list or a JSON string representing a list.
            Depends on condition_type. Used by "add" and "update".
        background_color (Optional[str]): Hex background color to apply when
            condition matches. Used by "add" and "update".
        text_color (Optional[str]): Hex text color to apply when condition matches.
            Used by "add" and "update".
        rule_index (Optional[int]): 0-based index of the rule. For "add", optionally
            specifies insertion position. Required for "update" and "delete".
        gradient_points (Optional[Union[str, List[dict]]]): List (or JSON list) of
            gradient points for a color scale. If provided, a gradient rule is created
            and boolean parameters are ignored. Used by "add" and "update".
        sheet_name (Optional[str]): Sheet name to locate the rule when range_name is
            omitted. Defaults to the first sheet. Used by "update" and "delete".

    Returns:
        str: Confirmation of the operation and the current rule state.
create_spreadsheet tool
Creates a new Google Spreadsheet.

    Args:
        user_google_email (str): The user's Google email address. Required.
        title (str): The title of the new spreadsheet. Required.
        sheet_names (Optional[List[str]]): List of sheet names to create. If not provided, creates one sheet with default name.
        folder_id (str): The ID of the parent folder. Defaults to 'root'. For shared
            drives, this must be a folder ID within the shared drive.

    Returns:
        str: Information about the newly created spreadsheet including ID, URL, and locale.
create_sheet tool
Creates a new sheet or duplicates an existing sheet, into destination_spreadsheet_id when given (user_google_email: str, spreadsheet_id: str, sheet_name: Optional[str] = None, source_sheet_name: Optional[str] = None, insert_sheet_index: Optional[int] = None, destination_spreadsheet_id: Optional[str] = None).
list_sheet_tables tool
Lists all structured tables in a spreadsheet with their IDs, names, ranges,
    and column details. Use this to find table IDs for append_table_rows.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.

    Returns:
        str: Formatted list of tables with their IDs, names, ranges, and columns.
append_table_rows tool
Appends rows to a structured table in a Google Sheet. The rows are added
    to the end of the table body, automatically extending the table range.

    Use list_sheet_tables first to find the table ID.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        table_id (str): The ID of the table to append to (get from list_sheet_tables). Required.
        values (Union[str, List[List]]): 2D array of values to append. Each inner
            list is one row. Can be a JSON string or Python list. Required.

    Returns:
        str: Confirmation message with the number of rows appended.
manage_sheet_tab tool
Manages an existing sheet tab: rename, delete, hide, unhide, reorder, or
    style (tab color and gridlines).

    Use create_sheet to add a tab, and resize_sheet_dimensions for row and column
    level changes. This tool operates on the tab itself.

    Args:
        user_google_email: User's Google email address
        spreadsheet_id: ID of the spreadsheet
        sheet_name: Title of the existing tab to act on
        action: One of "rename", "delete", "hide", "unhide", "reorder", "style"
        new_name: New title, required for action="rename"
        new_index: New zero-based position, required for action="reorder"
        tab_color: For action="style": hex tab color (#RRGGBB), or "none" to
            remove it
        show_gridlines: For action="style": show (True) or hide (False) the
            sheet's gridlines

    Returns:
        str: Confirmation of the change.
resize_sheet_dimensions tool
Manages sheet-level dimension properties: resize columns/rows, auto-resize
    to fit content, freeze rows/columns, hide/unhide rows/columns, and
    insert/delete rows/columns.

    Every row number and column letter refers to the sheet as it was before
    the call, even when one call both inserts and deletes. Deletes are applied
    before inserts, and an insert position inside a deleted span lands where
    that span was.

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        sheet_name (Optional[str]): Sheet name to target. Defaults to the
            first sheet if not provided.
        column_sizes (Optional[Union[str, dict]]): Dict mapping column letters
            to pixel widths. Example: {"A": 200, "C": 300}. Can be a JSON
            string or Python dict.
        row_sizes (Optional[Union[str, dict]]): Dict mapping 1-based row
            numbers to pixel heights. Example: {"1": 40, "3": 60}. Can be
            a JSON string or Python dict.
        auto_resize_columns (Optional[Union[str, List[str]]]): List of column
            letters to auto-resize to fit content. Example: ["A", "B"].
        auto_resize_rows (Optional[Union[str, List[int]]]): List of 1-based
            row numbers to auto-resize to fit content. Example: [1, 2].
        frozen_row_count (Optional[int]): Number of rows to freeze from the
            top. Use 0 to unfreeze all rows.
        frozen_column_count (Optional[int]): Number of columns to freeze from
            the left. Use 0 to unfreeze all columns.
        hide_columns (Optional[Union[str, List[str]]]): List of column letters
            to hide. Example: ["C", "D"].
        unhide_columns (Optional[Union[str, List[str]]]): List of column
            letters to unhide. Example: ["C", "D"].
        hide_rows (Optional[Union[str, List[int]]]): List of 1-based row
            numbers to hide. Example: [3, 4].
        unhide_rows (Optional[Union[str, List[int]]]): List of 1-based row
            numbers to unhide. Example: [3, 4].
        insert_rows (Optional[int]): Number of rows to insert.
        insert_rows_at (Optional[int]): 1-based row number to insert before.
            Appends to the end of the sheet if omitted.
        insert_columns (Optional[int]): Number of columns to insert.
        insert_columns_at (Optional[str]): Column letter to insert before
            (e.g. "C"). Appends to the end if omitted.
        delete_rows (Optional[Union[str, List[int]]]): List of 1-based row
            numbers to delete. Example: [5, 6]. Best for non-contiguous rows.
        delete_row_range (Optional[str]): Contiguous range of rows to delete,
            as "start:end" (1-based, inclusive). Example: "5:10" deletes rows
            5 through 10. More efficient than delete_rows for large contiguous
            ranges.
        delete_columns (Optional[Union[str, List[str]]]): List of column
            letters to delete. Example: ["E", "F"].

    Returns:
        str: Confirmation of the applied dimension changes.
move_sheet_rows tool
Moves rows from one sheet to another within the same spreadsheet. The move
    is performed in a single batchUpdate (copyPaste followed by
    deleteDimension). Note: batchUpdate executes requests sequentially but does
    not roll back on partial failure — if the copy succeeds but the delete
    fails, rows may be duplicated. Formulas, data types, and formatting are
    preserved (unlike a values.get/append round-trip).
    Row numbers are 1-based (matching the spreadsheet UI).

    Args:
        user_google_email (str): The user's Google email address. Required.
        spreadsheet_id (str): The ID of the spreadsheet. Required.
        source_sheet (str): Name of the sheet to move rows from. Required.
        start_row (int): First row to move (1-based, inclusive). Required.
        end_row (int): Last row to move (1-based, inclusive). Required.
        destination_sheet (str): Name of the sheet to move rows to. Required.

    Returns:
        str: Confirmation message with the number of rows moved.
manage_named_range tool
Manages the lifecycle of named ranges in a Google Sheet: list, create, update, or delete.

    Args:
        user_google_email: The user's Google email address. Required.
        spreadsheet_id: The ID of the spreadsheet. Required.
        action: The operation to perform: "list", "create", "update", or "delete". Required.
        name: Name for the named range (required for "create"; optional identifier for "update"/"delete").
        range_name: Target cell or range in A1 notation (e.g., "Sheet1!A1:D10", "A1:B5") (required for "create").
        named_range_id: The ID of the named range (optional identifier for "update"/"delete").
        new_name: New name for the named range (used with action="update").
        new_range: New A1-style range for the named range (used with action="update").

    Returns:
        str: Confirmation message or formatted list of named ranges.
create_presentation tool
Create a new Google Slides presentation and return its ID and URL.

    Args:
        user_google_email (str): The user's Google email address. Required.
        title (str): The title for the new presentation. Defaults to "Untitled Presentation".

    Returns:
        str: Details about the created presentation including ID and URL.
get_presentation tool
Read a deck: action "deck" (default) lists its slides and layouts, "page" gives one slide's element IDs and all its text (start here for content), "markup" gives one slide's elements as compact JSON with geometry and styles, "layouts" lists every layout.

    Actions:
        - "deck": Title, URL, revision, and per slide its ID, title, layout,
          element counts and notes length; then the deck's layouts with the
          placeholders each provides. Lists 100 slides per call; a longer deck
          ends with the offset to call again with. Uses offset.
        - "layouts": Every layout, grouped by master, with its placeholders
          and the slides using it. Only needed when "deck" says there are
          more layouts than it lists. Uses after.
        - "page": Every element on one slide with its ID, in z-order, groups
          nested, with all text, table cells, image sources and speaker notes.
          No geometry or styling. Requires page_id.
        - "markup": One slide, or chosen elements, as JSON: boxes in points
          ({"x","y","w","h"}), text as paragraphs and runs, styles in a shared
          "styles" table referenced by "s", only locally set properties.
          A shape with no "shape" key is a TEXT_BOX. Requires page_id; uses
          targets and raw.

    Args:
        user_google_email (str): The user's Google email address. Required.
        presentation_id (str): The ID of the presentation.
        action (str): "deck" (default): slides and layouts. "page": one
            slide's element IDs and text. "markup": one slide's elements as
            JSON with geometry and styles. "layouts": every layout.
        page_id (Optional[str]): Slide (or any page) object ID, from "deck".
            Required for "page" and "markup".
        targets (Optional[List[str]]): For "markup": element IDs to return
            instead of the whole slide, plus "notes" for the speaker notes.
            A target inside a group comes back with page coordinates and its
            "group" ID; a group comes back with its children.
        raw (bool): For "markup": return the Slides API Page resource itself
            (EMU, transforms, text indices), limited to targets when given,
            for writing raw batch_update_presentation requests. A target in a
            group keeps its group-relative transform. Defaults to False.
        offset (int): For "deck": index of the first slide to list, from the
            note at the end of a previous call. Defaults to 0.
        after (Optional[str]): For "layouts": a slide ID, or "start". Lists
            only the layouts of the master in use at that position, which are
            the only ones a new slide inserted there can use.

    Returns:
        str: The deck or layout digest, the page digest, or the markup JSON.
batch_update_presentation tool
Apply batch updates to a Google Slides presentation.

    Important:
        Each request object must contain exactly one supported Slides request
        type, such as createSlide, createShape, insertText, updateTextStyle,
        createImage, or deleteObject.

        insertText.objectId must be a text-capable shape or table object ID,
        not a slide/page object ID. To add text to a slide, create a text box
        or shape first with createShape, set elementProperties.pageObjectId to
        the slide ID, and then insertText into that shape objectId. To edit
        existing text, call get_presentation with action="page" and use a
        Shape or Table element ID.

        To write speaker (presenter) notes, call get_presentation with
        action="page" to get the slide's speaker notes shape ID, then target
        that ID: deleteText with textRange {"type": "ALL"} to clear
        the existing notes (omit this when they are already empty, which errors),
        followed by insertText at insertionIndex 0. The notes page ID is not a
        valid target.

    Args:
        user_google_email (str): The user's Google email address. Required.
        presentation_id (str): The ID of the presentation to update.
        requests (List[Dict[str, Any]]): List of update requests to apply.

    Returns:
        str: Details about the batch update operation results.
render_page_to_image tool
Render a slide (or any page, including notes pages) to an image and return it as image content, for looking at a slide's layout and visuals.

    This is the way to see a slide: use it instead of exporting the
    presentation to PPTX or PDF and rendering that.

    Args:
        user_google_email (str): The user's Google email address. Required.
        presentation_id (str): The ID of the presentation.
        page_object_id (str): The object ID of the page/slide to render.
        size (str): Image width. One of "SMALL" (200px), "MEDIUM" (800px),
            "LARGE" (1600px) or "WIDTH2000_PX" (2000px). Defaults to "MEDIUM".
            Start at MEDIUM: it reads titles and body text. Use LARGE for small
            text such as tables, chart labels and footnotes. WIDTH2000_PX
            rarely reads more than LARGE. SMALL shows layout only; its text is
            unreadable. Token cost and the resolution the model sees depend on
            the model: Claude models with high-resolution vision read MEDIUM at
            ~460 image tokens, LARGE at ~1,850 and WIDTH2000_PX at ~2,900, while
            other models may downscale LARGE and WIDTH2000_PX and count tokens
            differently.

    Returns:
        A short text block (presentation ID, page ID, size and a temporary
        image URL) followed by the rendered PNG as image content. If the image
        cannot be fetched, only the text block is returned, with a note saying
        so.
list_task_lists tool
List all task lists for the user.

    Args:
        user_google_email (str): The user's Google email address. Required.
        max_results (int): Maximum number of task lists to return (default: 1000, max: 1000).
        page_token (Optional[str]): Token for pagination.

    Returns:
        str: List of task lists with their IDs, titles, and details.
get_task_list tool
Get details of a specific task list.

    Args:
        user_google_email (str): The user's Google email address. Required.
        task_list_id (str): The ID of the task list to retrieve.

    Returns:
        str: Task list details including title, ID, and last updated time.
manage_task_list tool
Manage task lists: create, update, delete, or clear completed tasks.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform. Must be one of: "create", "update", "delete", "clear_completed".
        task_list_id (Optional[str]): The ID of the task list. Required for "update", "delete", and "clear_completed" actions.
        title (Optional[str]): The title for the task list. Required for "create" and "update" actions.

    Returns:
        str: Result of the requested action.
list_tasks tool
List all tasks in a specific task list.

    Args:
        user_google_email (str): The user's Google email address. Required.
        task_list_id (str): The ID of the task list to retrieve tasks from.
        max_results (int): Maximum number of tasks to return. (default: 20, max: 10000).
        page_token (Optional[str]): Token for pagination.
        show_completed (bool): Whether to include completed tasks (default: True). Note that show_hidden must also be true to show tasks completed in first party clients, such as the web UI and Google's mobile apps.
        show_deleted (bool): Whether to include deleted tasks (default: False).
        show_hidden (bool): Whether to include hidden tasks (default: False).
        show_assigned (bool): Whether to include assigned tasks (default: False).
        completed_max (Optional[str]): Upper bound for completion date (RFC 3339 timestamp).
        completed_min (Optional[str]): Lower bound for completion date (RFC 3339 timestamp).
        due_max (Optional[str]): Upper bound for due date (RFC 3339 timestamp).
        due_min (Optional[str]): Lower bound for due date (RFC 3339 timestamp).
        updated_min (Optional[str]): Lower bound for last modification time (RFC 3339 timestamp).

    Returns:
        str: List of tasks with their details.
get_task tool
Get details of a specific task.

    Args:
        user_google_email (str): The user's Google email address. Required.
        task_list_id (str): The ID of the task list containing the task.
        task_id (str): The ID of the task to retrieve.

    Returns:
        str: Task details including title, notes, status, due date, etc.
manage_task tool
Manage tasks: create, update, delete, or move tasks within task lists.

    Args:
        user_google_email (str): The user's Google email address. Required.
        action (str): The action to perform. Must be one of: "create", "update", "delete", "move".
        task_list_id (str): The ID of the task list. Required for all actions.
        task_id (Optional[str]): The ID of the task. Required for "update", "delete", and "move" actions.
        title (Optional[str]): The title of the task. Required for "create", optional for "update".
        notes (Optional[str]): Notes/description for the task. Used by "create" and "update" actions.
        status (Optional[str]): Task status ("needsAction" or "completed"). Used by "update" action.
        due (Optional[str]): Due date in RFC 3339 format (e.g., "2024-12-31T23:59:59Z"). Used by "create" and "update" actions.
        parent (Optional[str]): Parent task ID (for subtasks). Used by "create" and "move" actions.
        previous (Optional[str]): Previous sibling task ID (for positioning). Used by "create" and "move" actions.
        destination_task_list (Optional[str]): Destination task list ID (for moving between lists). Used by "move" action.

    Returns:
        str: Result of the requested action.
manage_event tool
manage_event tool
get_events tool
search_messages tool
start_google_auth tool

What we checked

The same checks run on every server. Each line below has one of these marks:

FoundA published issue such as a risky tool or a CVE
PassedWe ran the check on this server and found nothing
After reviewChecked; we publish it once a person verifies it
Partly tracedRan, but the scanner could not follow every path to its end
FactWhat the code does, not a judgement either way
Not checkedThe scanner had nothing to read for it, or it needs the live server
Code Safetypartly traced
  • 8 checks: command injection, argument injection, path traversal, server-side request forgery, SQL injection, code execution, unsafe deserialization, template injection
    Checked on every scan. Results in this category are published only after a person has verified them.
Capability Exposure6.1
  • Runs programs the caller chooses
    No tool runs a command or program the caller supplies — 115 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Executes caller-supplied code
    No tool evaluates code the caller supplies — 115 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Reads or writes any file path
    No tool works on a file path the caller supplies without a root check — 115 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Requests any address
    No tool sends a request to an address the caller supplies — 115 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Runs caller-supplied SQL
    No tool executes a query the caller supplies — 115 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Tools that start processes
    Not seen in the traced code of 115 capabilities; 112 more call code the scanner could not follow, where it may happen
  • Tools that touch files
    11 of 115 capabilities touch files; 101 more call code the scanner could not follow, where it may happen
  • Tools that call the network
    14 of 115 capabilities call the network; 98 more call code the scanner could not follow, where it may happen
Where the code is: 115 handlers in 15 files at commit 21ad3daa6562
Prompt Integrity10.0
  • 5 checks: tool poisoning, instruction override, hidden content, exfiltration requests, metadata integrity
    Checked on every scan. Results in this category are published only after a person has verified them.
Supply Chain7.0
  • Dependency manifests
    1 manifest: pyproject.toml
  • Lockfiles checked against OSV
    1 file resolved and checked against the OSV database; 1 not resolved: pyproject.toml: dependency ranges declared here were not resolved against a lockfile and were not checked
  • Known vulnerabilities in production dependencies
    No production dependency with a known advisory
  • Known vulnerabilities in other dependencies
    No package used only for development, tests or examples has a known advisory
  • MCP SDK version
    fastmcp >=4.1.2
Secrets & Credentials10.0
  • 3 checks: credential harvesting, undeclared credential access, credentials sent over the network
    Checked on every scan. Results in this category are published only after a person has verified them.
  • Tools that read credentials
    10 of 115 capabilities read credentials; 102 more call code the scanner could not follow, where it may happen
  • Environment variables
    10 capabilities read environment variables (often API keys)
  • Authentication declared
    Not checked: needs the live server's tools/list (a remote server declares how clients authenticate)
Behavior Transparency10.0
  • 3 checks: undeclared network access, undeclared file access, undeclared process execution
    Checked on every scan. Results in this category are published only after a person has verified them.
  • Tool descriptions present
    Every tool has a description the model and the user can read (2 only in code no tool reaches)
  • Statically known names
    Every tool's name could be read from the code
  • Input schemas
    Not checked: needs the live server's tools/list (every tool declares an input schema)
  • Destructive tools annotated
    Not checked: needs the live server's tools/list (tools that write, delete or run commands carry destructivehint)

Dependencies with known vulnerabilities (0 in production)

Dependency ranges were not resolved against a lockfile, so the score is capped at 7.

No known vulnerabilities in the production dependencies that could be checked.

Past security advisories

Vulnerabilities published for this server itself, from the GitHub Advisory Database.

No security advisories have been published for this server in the GitHub Advisory Database.

How it runs

Where it runsOn your machine, started by your MCP client from this repository or its package
TransportStreamable HTTP
Sign-innot checked needs the live server
MCP SDKfastmcp >=4.1.2
Servers in the code13 (test, scoping-test, camel-case-test, camel-case-edge, camel-case-collision, portable-schema-test, probe, hide-test, compose-test)

The project's own security

Security policyyes SECURITY.md
Private reportingthe policy does not name a private channel
Past advisoriesnone in the GitHub Advisory Database
Last push2026-11-14
Signed releasesnot checked yet

Where it is published

Listed in5 catalogs (awesome_habitoai, github_search, glama, mcp_toplist, mcpservers_org)
LicenseMIT
Created2025-04-27
Topicsai chatgpt claude claude-code claude-desktop gmail google-calendar google-chat google-docs google-drive

Attack map

How the server is built and where its risky tools lead: servers, their tools, what the tools' code can do, and the traced route from a declared risky tool's argument to the operation it reaches. Click a node for details.

Request a scan or an audit

Tell us about your server. We reply within 5 working days.

What do you need? *

We use these details only to answer you.