createBot
Generate a new Typebot chatbot by specifying a name and optional description. Ideal for quickly setting up chatbot workflows using the MCP-Typebot server’s JSON interface.
Instructions
Crea un nuevo Typebot. Requiere “name”, opcional “description”
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | ||
| name | Yes | ||
| workspaceId | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"description": {
"type": "string"
},
"name": {
"minLength": 1,
"type": "string"
},
"workspaceId": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- src/tools/bots.ts:18-41 (handler)The core handler function that ensures authentication, derives workspaceId, builds the payload, and creates a new Typebot via API POST request.export async function createBot(args: CreateBotArgs) { ensureAuth(); const workspaceId = args.workspaceId || process.env.TYPEBOT_WORKSPACE_ID; if (!workspaceId) { throw new Error( 'createBot: falta workspaceId (ni en args ni en process.env)' ); } const payload = { workspaceId, typebot: { name: args.name, description: args.description, }, }; const response = await axios.post( 'https://app.typebot.io/api/v1/typebots', payload ); return response.data; }
- src/index.ts:39-43 (schema)Zod schema for input validation of the createBot tool, matching the CreateBotArgs interface.schema: z.object({ workspaceId: z.string().optional(), name: z.string().min(1, "El campo 'name' es obligatorio."), description: z.string().optional(), }),
- src/index.ts:36-44 (registration)Tool registration entry in toolsMap, linking the createBot function, its description, and schema for MCP server registration.['createBot', { func: createBot, description: 'Crea un nuevo Typebot. Requiere “name”, opcional “description”', schema: z.object({ workspaceId: z.string().optional(), name: z.string().min(1, "El campo 'name' es obligatorio."), description: z.string().optional(), }), }],
- src/tools/bots.ts:12-16 (schema)TypeScript type definition for CreateBotArgs used in the handler function signature.export interface CreateBotArgs { workspaceId?: string; name: string; description?: string; }
- src/tools/bots.ts:3-10 (helper)Helper function ensureAuth() called at the start of createBot to verify Authorization token is set.function ensureAuth() { const header = axios.defaults.headers.common['Authorization']; if (!header) { throw new Error( 'No hay token configurado. Llama primero a authenticate o define TYPEBOT_TOKEN.' ); } }