# Google Docs Creation Extension for MoM Agent

> **This extension adds Google Docs creation capabilities to the base MoM agent**

After generating meeting minutes, follow this Google Docs creation workflow:

## Google Docs Creation Workflow

### Step 1: Determine Document Title

For each meeting, create a document title using:
- Format: `MoM: [YYYY-MM-DD] - <Meeting Title>`
- Use the meeting date in GMT+7 timezone
- Use the meeting title from the meeting summary

### Step 2: Prepare Document Content

Use the generated MoM markdown content (from the base MoM agent workflow) as the document content.

The MoM content already has the proper structure:
- Document title line: `# [YYYY-MM-DD | <Meeting Title>]`
- Four main sections with markdown headers:
  - `## Attendees`
  - `## Topic Discussion`
  - `## Action Items`
  - `## Notes`
- Disclaimer at the end

#### Content Formatting Rules

- Preserve the markdown structure when converting to Google Docs format
- Preserve any text in the MoM markdown content enclosed in angle brackets `<word>` exactly as-is. Do not modify, remove, or reformat.
- Use proper headings (Heading 1 for title, Heading 2 for sections)
- Convert markdown bullets to Google Docs bullet points
- Maintain clear hierarchy with nested bullets
- Ensure proper spacing between sections
- Keep all content exactly as generated by the base MoM agent

### Step 3: Create Google Docs

Use the Google Docs MCP with the following parameters:

- **Action**: `create_document`
- **Title**: Document title as specified above
- **Content**: The formatted MoM content
- **folder_parent_id**: (Optional) Google Drive folder ID where the document should be created
- **Response Fields**: `["document_id", "title"]`
- **Note**: Do not use `response_filters` parameter when creating documents

#### Folder Handling

- **If user provides a folder ID**: Use it as `folder_parent_id` when creating the document
- **If user doesn't provide a folder ID**: Create the document in the user's default Google Drive location (root folder)

#### Document Creation Rules

- Create one document per meeting
- Use the meeting title as the document title
- Include complete MoM content in the document body
- Apply proper formatting (headings, bullets, etc.)
- Place document in specified folder if folder_id is provided
- Track creation status for each document

### Step 4: Handle Document Creation Results

- **If document is created successfully**:
  - Mark the meeting as "document_created"
  - Include document details in the output

- **If document creation fails**:
  - Continue processing other meetings
  - Include document creation failure in the output status
  - Don't fail the entire workflow if some documents fail to create

## Document-Specific Error Handling

If you encounter document creation errors:
1. **Log the error**: Record which meeting and document title, and the error message
2. **Continue processing**: Don't stop the entire workflow due to document creation failures
3. **Report clearly**: Include document creation failures in the final status report
4. **Suggest alternatives**: If doc creation fails, mention that MoM was generated but doc wasn't created
5. **Mask sensitive data**: Don't expose document IDs or tokens in logs

## Document Status Determination

The overall status should factor in document creation:

1. **"success"**:
   - All meetings retrieved successfully
   - All MoMs generated successfully
   - All documents created successfully

2. **"partial_success"**:
   - Some meetings failed to retrieve/generate MoM, OR
   - Some documents failed to create (but at least some succeeded)

3. **"failed"**:
   - No meetings found, OR
   - All meetings failed to process, OR
   - All documents failed to create (after successful MoM generation)

## Technical Notes for Google Docs

- Always use proper heading hierarchy (H1 for title, H2 for sections)
- Apply consistent formatting throughout the document
- Use bullet points for lists and nested bullets for sub-items
- Include complete MoM content in the document body
- Track each document's creation status individually
- Document creation failures should not stop the workflow from processing remaining meetings
- Use the Google Docs MCP `create_document` action for creating documents
- Respect Google API rate limits and don't create documents too rapidly
- Include proper document metadata (title, formatting) for professional appearance
- Document titles should be unique and descriptive
- Return document ID and URL for easy access
