create_group
Create a new group chat with a specified name and optional description, and add initial members by their open IDs.
Instructions
[Official API] Create a new group chat (as bot). Can add initial members.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Group name | |
| description | No | Group description (optional) | |
| user_ids | No | Initial member open_ids (optional) |
Implementation Reference
- src/tools/groups.js:62-64 (handler)The handler function for create_group. Calls ctx.getOfficialClient().createChat() with the name, description, and user_ids from args, then returns a text response with the new chat ID.
async create_group(args, ctx) { return text(`Group created: ${(await ctx.getOfficialClient().createChat({ name: args.name, description: args.description, userIds: args.user_ids })).chatId}`); }, - src/tools/groups.js:5-18 (schema)Schema definition for the create_group tool. Defines name as required, with optional description and user_ids (array of strings) as inputs.
const schemas = [ { name: 'create_group', description: '[Official API] Create a new group chat (as bot). Can add initial members.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Group name' }, description: { type: 'string', description: 'Group description (optional)' }, user_ids: { type: 'array', items: { type: 'string' }, description: 'Initial member open_ids (optional)' }, }, required: ['name'], }, }, - src/clients/official/groups.js:10-21 (helper)The underlying API client method `createChat` that actually calls the Feishu SDK's im.chat.create API. Maps input args to SDK parameters and returns the new chat_id.
async createChat({ name, description, userIds, botIds } = {}) { const data = {}; if (name) data.name = name; if (description) data.description = description; if (userIds) data.user_id_list = userIds; if (botIds) data.bot_id_list = botIds; const res = await this._safeSDKCall( () => this.client.im.chat.create({ params: { user_id_type: 'open_id' }, data }), 'createChat' ); return { chatId: res.data.chat_id }; }, - src/server.js:37-57 (registration)Registration mechanism: groups.js is loaded via TOOL_MODULES, its schemas are collected into TOOLS, and its handlers are merged into HANDLERS by name. create_group is dispatched via HANDLERS[name] in the CallToolRequest handler.
const TOOL_MODULES = [ require('./tools/bitable'), require('./tools/calendar'), require('./tools/contacts'), require('./tools/diagnostics'), require('./tools/docs'), require('./tools/drive'), require('./tools/events'), require('./tools/groups'), require('./tools/im-read'), require('./tools/messaging-bot'), require('./tools/messaging-user'), require('./tools/okr'), require('./tools/profile'), require('./tools/tasks'), require('./tools/uploads'), require('./tools/wiki'), ]; const TOOLS = TOOL_MODULES.flatMap((m) => m.schemas); const HANDLERS = Object.fromEntries(TOOL_MODULES.flatMap((m) => Object.entries(m.handlers)));