github →

New request

#20407: Twenty MCP: draft_email depends on connectedAccountId, but find_connected_accounts returns 0 records for connected Gmail accounts

We'll provision a sandbox, run an agent against the issue, and open a draft PR. You can pull the branch and iterate from there.

Issue
sonarly:high

Bug Description

When using Twenty MCP to create email drafts, the account discovery flow appears broken.

The MCP exposes a draft_email tool with an optional connectedAccountId field, and a find_connected_accounts tool that appears to be the obvious way to discover those IDs. However, find_connected_accounts returns 0 records, even when Gmail accounts are already connected in the Twenty workspace.

This creates a mismatch between the visible app state and the MCP tool behavior, and makes it difficult or impossible to reliably choose the sending account for email draft creation.

Expected behavior

If Gmail accounts are connected in the workspace, they should be discoverable through the MCP flow used for email drafting.

Expected behavior:

  • find_connected_accounts returns the connected Gmail account records and their IDs, or
  • draft_email works reliably without needing connectedAccountId, using a clear default connected account, or
  • the correct tool for resolving usable email account IDs is documented and exposed clearly

Technical inputs

  • Relevant MCP tools:
    • draft_email
    • find_connected_accounts
  • draft_email includes a connectedAccountId field intended to specify the sending account
  • Actual result from find_connected_accounts:
    {
      "success": true,
      "message": "Found 0 connectedAccount records",
      "result": {
        "records": [],
        "count": "0"
      },
      "recordReferences": []
    } 
    

This suggests either:   • connected Gmail accounts are not being surfaced through find_connected_accounts, or   • find_connected_accounts is not the correct lookup path for draft_email, but that relationship is currently unclear

Assessmentadvisory
bug●● medium80% confidence

The MCP find_connected_accounts tool returns zero records, preventing discovery of the connectedAccountId required by draft_email.

Likely files
  • packages/twenty-server/src/engine/core-modules/mcp/tools/draft-email.tool.ts
  • packages/twenty-server/src/engine/core-modules/mcp/tools/find-connected-accounts.tool.ts
  • packages/twenty-server/src/engine/core-modules/connected-account/services/connected-account.service.ts
Create the request

This opens a fresh agent run and a draft PR for issue #20407.

Cancel