fulcrum: "1.0"
name: calendar_get_attachment
description: >
  Get attachment metadata for a Google Calendar event. Calendar attachments are
  typically Google Drive file references (not inline data like Gmail). Returns
  file metadata including Drive fileUrl for download. Use drive_download to
  fetch the actual file content.

schema:
  input:
    type: object
    properties:
      calendar_id:
        type: string
        description: Calendar ID (use 'primary' for main calendar)
        default: primary
      event_id:
        type: string
        description: The ID of the calendar event
    required: [event_id]
  output:
    type: object
    properties:
      id:
        type: string
        description: Event ID
      summary:
        type: string
        description: Event title
      attachments:
        type: array
        items:
          type: object
          properties:
            file_url:
              type: string
              description: URL to the attached file (usually a Google Drive link)
            title:
              type: string
              description: Attachment title/filename
            mime_type:
              type: string
              description: MIME type of the attachment
            icon_link:
              type: string
              description: URL to the attachment icon
            file_id:
              type: string
              description: Google Drive file ID (use with drive_download to fetch content)
        description: List of attachments on the event (Drive file references)

providers:
  primary:
    service: rest
    cost_per_call: 0
    timeout: 30
    config:
      base_url: https://www.googleapis.com
      path: /calendar/v3/calendars/{calendar_id}/events/{event_id}
      method: GET
      headers:
        Authorization: "Bearer {access_token}"
        Accept: "application/json"
      response_transform: |
        attachments = data.get("attachments", [])
        return {
            "id": data.get("id"),
            "summary": data.get("summary"),
            "attachments": [
                {
                    "file_url": a.get("fileUrl"),
                    "title": a.get("title"),
                    "mime_type": a.get("mimeType"),
                    "icon_link": a.get("iconLink"),
                    "file_id": a.get("fileId")
                }
                for a in attachments
            ]
        }

cache:
  strategy: exact
  ttl: 300

auth:
  required: true
  type: oauth
  key: "oauth:google"
  token_endpoint: "https://oauth2.googleapis.com/token"
  scopes:
    - https://www.googleapis.com/auth/calendar.readonly

metadata:
  category: google
  tags: [calendar, events, attachment, download, drive, productivity]
  cost_category: free
  execution_time: fast
  read_only: true
  notes: |
    Google Calendar attachments are NOT inline binary data. They are references
    to Google Drive files. The workflow to download a calendar attachment is:
    1. calendar_get_attachment -> get file_id from attachments list
    2. drive_download(file_id=file_id) -> get actual file content
    The event must have been created with supportsAttachments=true for
    attachments to be present in the response.
