chat_sessionRun a grounded chat for a domain.
When the surface is "talk to a visitor on a website" rather than "answer one question", the agent needs a session — message history, grounded retrieval over the site's content, optional handoff. chat_session opens or resumes that session and routes messages through the FoxAPIs tool layer. Two credits per turn. Sub-second.
When to call this tool
This is the canonical surface for embedding a grounded chat anywhere. The agent passes the site identifier, the visitor message, and optionally the session id; the tool handles retrieval, generation, and tool-calling against the FoxAPIs catalog. Sessions are first-class objects — visitors can return tomorrow and resume; chat_history retrieves the transcript; chat_export bundles a domain's transcripts for analysis.
Input schema
{ "site_id": "…", "message": "…", "session_id": "… (optional, omit to start)", "visitor": { "name", "email" } }
Output schema
{ "session_id": "…", "reply": "…", "sources": ["url"], "tool_calls": ["…"], "credits_used": 2 }
Example invocations
1. Claude Desktop
Open a chat session on site_xyz, send: "What's the difference between your pro and team plans?"
2. ChatGPT custom GPT
For visitor-facing chat embeds, route every turn through chat_session. Always show sources beneath the reply.
3. Cursor MCP
Build a CLI: foxapis chat <site_id> "message".
4. n8n
{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "chat_session", "arguments": { "site_id": "site_xyz", "message": "hi" } } }
5. Raw curl
curl -X POST https://www.mentionfox.com/mcp \ -H "Authorization: Bearer $FOXAPIS_KEY" \ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"chat_session","arguments":{"site_id":"site_xyz","message":"What is your refund policy?"}}}'
Sample output
{ "session_id": "sess_b3f1", "reply": "You can request a refund within 14 days, full details on /refunds.", "sources": ["https://example.com/refunds"], "credits_used": 2 }
Credit cost & rate limits
2 credits per turn. 240 turns per minute per key. Sessions persist 90 days by default.
Error codes & recovery
404 NO_SITESite id not registered. Register the site in the dashboard first.410 SESSION_EXPIREDSession id older than retention window. Start a new one.