startChat
Initiate a chat session with a Typebot using a specific botId, optionally include chat context for personalized interactions via the MCP-Typebot server.
Instructions
Inicia un chat con un Typebot. Requiere botId, opcional chat.context
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| botId | Yes | ||
| chat | No |
Implementation Reference
- src/tools/bots.ts:218-232 (handler)The core handler function that implements the 'startChat' tool logic. It authenticates, validates botId, prepares payload with optional chat context, and POSTs to Typebot API to start a chat session.export async function startChat(args: StartChatArgs) { ensureAuth(); const { botId, chat } = args; if (!botId) throw new Error('startChat: falta botId'); const payload: Record<string, any> = {}; if (chat) payload.chat = chat; const response = await axios.post( `https://app.typebot.io/api/v1/typebots/${botId}/chat/start`, payload ); return response.data; }
- src/tools/bots.ts:211-216 (schema)TypeScript interface defining the input parameters for the startChat function: required botId and optional chat object with context.export interface StartChatArgs { botId: string; chat?: { context?: Record<string, any>; }; }
- src/index.ts:93-98 (schema)Zod schema for input validation of the 'startChat' tool, used in MCP tool registration.schema: z.object({ botId: z.string().min(1, "El campo 'botId' es obligatorio."), chat: z.object({ context: z.record(z.any()).optional(), }).optional(), }),
- src/index.ts:90-99 (registration)Registration entry in toolsMap for the 'startChat' tool, including func reference, description, and input schema, which is later used to register the tool with the MCP server.['startChat', { func: startChat, description: 'Inicia un chat con un Typebot. Requiere botId, opcional chat.context', schema: z.object({ botId: z.string().min(1, "El campo 'botId' es obligatorio."), chat: z.object({ context: z.record(z.any()).optional(), }).optional(), }), }],