Command Inbox
User Guide

Agent chat

Corsair MCP agent with typed tools and human-in-the-loop approval

The agent chat panel lets you perform multi-step Gmail and Calendar operations in natural language. Corsair MCP discovery tools and typed workflow tools run in the Next.js server — no separate MCP server required for in-app chat.

Toggle the panel from the inbox header.

What the agent can do

Discovery (read-only)

ToolPurpose
list_operationsDiscover available Gmail/Calendar operations
get_schemaInspect operation input schemas

Typed workflow tools

ToolPurposeApproval required
send_emailSend mail with optional attachmentsYes
schedule_sendQueue mail for laterYes
create_calendar_inviteCreate event with Google Meet linkYes
reschedule_calendar_eventMove an existing eventYes
cancel_calendar_eventCancel an eventYes
stage_thread_attachmentStage a thread attachment for a later sendNo
search_threadsSearch Gmail by query and optional laneNo
list_calendar_eventsList events in a date rangeNo

Write operations use typed tools with rich approval cards — not raw run_script. The agent may also call curated Corsair discovery operations for reads.

Example prompts

Schedule + draft (hackathon demo prompt):

Send a calendar invite to friend@corsair.dev at 9 AM next Thursday and draft a confirmation reply.

Search threads:

Find threads from alice@company.com in the schedule lane.

Calendar check:

What meetings do I have tomorrow afternoon?

Approval flow

When the agent calls a tool with needsApproval (e.g. send_email, create_calendar_invite):

  1. Stream pauses with an approval card showing recipients, subject, time, or Meet link
  2. You Approve or Deny
  3. On approve, the action runs against your Corsair tenant
  4. Results stream back into the chat

Never approve actions you do not understand — they run with your Google OAuth credentials.

Provider selection

The agent uses the same AI provider switcher as drafts and classification (OpenAI or Gemini). Provider is sent with each chat request.

Streaming

Responses stream token-by-token using the Vercel AI SDK UI message format. Tool calls appear as structured parts in the transcript.

Maximum request duration: 60 seconds.

Requirements

  • Gmail + Calendar fully connected
  • At least one AI API key configured server-side
  • Phase 2 env (assertPhase2Env)

Limitations

  • Agent operates on your tenant only — no cross-user access
  • Complex multi-day workflows may hit the 60s timeout
  • If both AI providers are quota-exhausted, chat fails with an error (no template fallback for chat)

API

POST /api/agent/chat — see API routes and Corsair MCP tools.