ai_chat
Submit questions to Secoda AI and get answers. Continue conversations by passing the chat ID from a previous session.
Instructions
Start an AI chat session in Secoda and wait for the response.
Submits a prompt to the Secoda embedded AI endpoint and polls until the
response is complete. Sends MCP progress notifications at each poll interval
so clients can show elapsed time. Returns the AI's response text along with
the chat ID, which can be passed as `parent` in a follow-up call to continue
the conversation.
Args:
prompt: The message or question to send to the Secoda AI.
ctx: MCP context (injected by FastMCP; not part of the tool schema).
parent: Chat ID of a previous conversation to continue (optional).
Pass the chat_id from a previous ai_chat response to maintain context.
persona_id: Persona ID to use for the AI chat (optional).
Defaults to AI_PERSONA_ID env var if set, otherwise the workspace default persona.
poll_interval_seconds: Seconds between polling attempts (default: 10).
timeout_seconds: Maximum seconds to wait for completion (default: 360).
Returns:
JSON with keys:
- success: true
- chat_id: The ID of this chat (use as `parent` in follow-up calls)
- status: "completed"
- response_content: The AI's response text
Example:
# Start a new conversation
ai_chat(prompt="How do we handle price reductions in GMV calculations?")
# Continue a previous conversation
ai_chat(
prompt="Can you elaborate on the discount logic?",
parent="0d53d57b-d1ef-4fc2-bc50-fd3fba2fea93"
)
Error handling:
- 403: Permission denied - check API token has AI chat permissions
- 429: Rate limit exceeded - tool retries automatically
- Timeout: Increase timeout_seconds if the AI takes longer than expected
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | The message or question to send to the Secoda AI | |
| parent | No | Chat ID of a previous conversation to continue. Use the chat_id returned from a previous ai_chat call to maintain conversation context. | |
| persona_id | No | Persona ID to use for the AI chat. Defaults to the AI_PERSONA_ID environment variable if set, otherwise the workspace default persona is used. | |
| poll_interval_seconds | No | Seconds between polling attempts while waiting for the AI to respond (default: 10) | |
| timeout_seconds | No | Maximum seconds to wait for the AI to complete the response (default: 360) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |