Topolo Docs Topolo Platform
Open workspace

Get Mail thread

Read messages belonging to a discovered thread in the selected mailbox.

Outcome

Read messages belonging to a discovered thread in the selected mailbox.

Before you start

  • Verify the intended environment, credential and authorized organization context before discovery.
  • Discover Mail, the exact action and its messages:read permission. Select an accessible canonical workspace and discover the mailbox there; pass workspace resource context separately from mailboxId.

Discover the target

  • Run credential-scoped Mail discovery, select an authorized canonical workspace and list Mail mailboxes there.
  • Discover message, thread, folder and attachment identifiers through the related reads; never reuse fixture identifiers or another organization’s records.
topolo whoami --json
topolo apps get topolo-mail --json
topolo actions get app_topolo_mail.threads.get --json
topolo workspaces list topolo-mail --json
topolo actions get app_topolo_mail.mailboxes.collection.list --json

Use the currently discovered mailbox-collection action to resolve mailboxId in the selected workspace. Discover and validate its schema before execution. Fixture IDs below do not grant access.

Request

Create payload.json with the current schema and discovered identifiers. This action is a read; do not use confirmation to authorize unrelated sends or data changes.

topolo actions validate app_topolo_mail.threads.get --data @payload.json --json
topolo actions plan app_topolo_mail.threads.get --resource-type workspace --resource-id <discovered-workspace-id> --data @payload.json --json
topolo actions call app_topolo_mail.threads.get --resource-type workspace --resource-id <discovered-workspace-id> --data @payload.json --json

For MCP, discover with topolo_get_action, validate with topolo_validate_action, plan with topolo_plan_action and execute with topolo_read_action. Pass resourceType workspace and the discovered resourceId separately from input. A service/action absent from the credential-scoped catalog blocks that operation.

Input fields

FieldRequiredMeaning
mailboxIdYesExact mailbox ID returned by the current credential’s Mail mailbox collection in the selected canonical workspace. It is distinct from the workspace resource ID.
threadIdYesExact thread ID returned by a message in this mailbox; optional filtering for messages.list.

Effects

  • Reads the mailbox tool’s thread collection without marking messages read, sending or moving them.

Interpret the response

data is the mailbox thread collection, not data.messages. An unknown fixture thread returns an empty array; an empty collection is not authorization to invent message or attachment IDs.

Worked requests and responses

Successful fixture read · HTTP 200

Input

{
  "mailboxId": "mbx_mail_fixture",
  "threadId": "thr_mail_fixture"
}

SDK response or error

{
  "success": true,
  "data": [
    {
      "id": "msg_mail_fixture",
      "threadId": "thr_mail_fixture",
      "folderId": "inbox",
      "direction": "inbound",
      "subject": "Fixture status",
      "sender": "sender@example.test",
      "recipients": [
        "fixture@example.test"
      ],
      "date": "2026-10-07T00:00:00.000Z",
      "read": false,
      "starred": false,
      "attachments": [
        {
          "id": "att_mail_fixture",
          "filename": "fixture.bin",
          "contentType": "application/octet-stream",
          "size": 4,
          "r2Key": "private/fixture.bin"
        }
      ]
    }
  ]
}

Unknown thread returns an empty collection · HTTP 200

Input

{
  "mailboxId": "mbx_mail_fixture",
  "threadId": "thr_missing_fixture"
}

SDK response or error

{
  "success": true,
  "data": []
}

Refused requests

unauthenticated · HTTP 401

Input

{
  "mailboxId": "mbx_mail_fixture",
  "threadId": "thr_mail_fixture"
}

SDK response or error

{
  "code": "auth_error",
  "status": 401,
  "message": "Fixture authentication refused"
}

HTTP body and transport

{
  "contentType": "application/json",
  "contentDisposition": null,
  "body": {
    "success": false,
    "error": {
      "message": "Fixture authentication refused"
    }
  }
}

permission denied · HTTP 403

Input

{
  "mailboxId": "mbx_mail_fixture",
  "threadId": "thr_mail_fixture"
}

SDK response or error

{
  "code": "permission_denied",
  "status": 403,
  "message": "TopoloMail permission denied"
}

HTTP body and transport

{
  "contentType": "application/json",
  "contentDisposition": null,
  "body": {
    "success": false,
    "error": {
      "message": "TopoloMail permission denied"
    }
  }
}

other organization · HTTP 403

Input

{
  "mailboxId": "mbx_mail_fixture",
  "threadId": "thr_mail_fixture"
}

SDK response or error

{
  "code": "permission_denied",
  "status": 403,
  "message": "Mailbox does not belong to your organization"
}

HTTP body and transport

{
  "contentType": "application/json",
  "contentDisposition": null,
  "body": {
    "success": false,
    "error": {
      "message": "Mailbox does not belong to your organization"
    }
  }
}

other workspace · HTTP 404

Input

{
  "mailboxId": "mbx_mail_fixture",
  "threadId": "thr_mail_fixture"
}

SDK response or error

{
  "code": "http_error",
  "status": 404,
  "message": "Mailbox not found"
}

HTTP body and transport

{
  "contentType": "application/json",
  "contentDisposition": null,
  "body": {
    "success": false,
    "error": {
      "message": "Mailbox not found"
    }
  }
}

unknown mailbox · HTTP 404

Input

{
  "mailboxId": "mbx_missing_fixture",
  "threadId": "thr_mail_fixture"
}

SDK response or error

{
  "code": "http_error",
  "status": 404,
  "message": "Mailbox not found"
}

HTTP body and transport

{
  "contentType": "application/json",
  "contentDisposition": null,
  "body": {
    "success": false,
    "error": {
      "message": "Mailbox not found"
    }
  }
}

Verify the result

  • Compare the returned mailbox/message/thread identifiers with the selected mailbox and canonical workspace; an HTTP success alone is not the intended-result check.
  • Use the response interpretation above and related published reads to verify the result. Do not infer a provider outcome, send completion or encryption guarantee from this read.

Recover

This action requests no delivery or deletion. Preserve failures and recover only through the published read/error guidance; no rollback mutation is needed. Inbox/snooze reads can remove expired overlays and folder reads can synchronize provider cache, as stated in effects.

  • HTTP 401 auth_error: Authenticate again in the intended environment and context, then repeat identity and discovery. Do not change organization automatically.
  • HTTP 403 permission_denied: Stop and inspect the exact permission or organization refusal. Connection reads additionally require mailbox management permission. Do not broaden access or switch credentials automatically.
  • HTTP 404 http_error: Rediscover the mailbox and child identifiers in the same authorized canonical workspace. A missing or differently scoped mailbox is not permission to guess another ID.

Evidence and limits

  • Actual exported Mail API route dispatcher, handlers, authorization branches, contract validation and SDK 0.23.13 response projection; shipped control, delivery and tracking migrations execute against in-memory SQLite through the D1 adapter.

  • Verified identity and workspace grants are supplied fixtures; no live OAuth, API-key introspection, CLI/MCP gateway or deployed environment is proved.

  • Mailbox Durable Object/tool responses and content unprotection are fixture ports. No provider sync, encryption custody, notification or delivery outcome is proved. External network egress is refused.

These examples use synthetic mailboxes, messages and identities. They demonstrate request and response behavior without delivering email or contacting a live provider. Discover the available action and its current contract before using it with your own authorized workspace.