v9

latestOpenAPI 3.1.02026-08-08435208464.3 KB
Thread Management

Create Thread

Creates a new thread row.

WHO ACTUALLY CALLS THIS:

  • mcp_server/admin/handlers/assistant.py (the admin MCP server at mcp.every.ai). External AI integrations like Claude.ai and ChatGPT invoke the ask_assistant MCP tool, which POSTs here to seed a thread before streaming agent output.

WHO DOES NOT:

  • The web app (every-react) creates threads via a direct Supabase insert in packages/agent-chat/contexts/ThreadContext.tsx — RLS-protected.
  • The mobile app (every-mobile-app) does the same in src/stores/threadStore.ts.

storage_mode is always "session"; the threads table column has the same NOT NULL default, so direct Supabase inserts land on the same value.

Idempotency: protected by idempotency_guard so MCP retries don't create duplicate threads. The MCP server doesn't send X-Idempotency-Key today but the guard is in place for future retry logic.

thread_data.metadata (optional) is merged as-is into the threads row's jsonb metadata column — e.g. the MCP handler stamps {"source": "chatgpt"|"claude"|"mcp"} so non-app clients are attributable without inferring it from the hardcoded thread name.

post/api/create-thread

Query parameters

user_idstring
org_idstring

Request body

namestring nullable
primary_agentstring nullable
stepstring nullable
active_agentstring nullable
metadataobject nullable

Response

Successful Response

{"stackTrail":"paths:/api/create-thread:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}