swit-message-create
Send messages to channels in Swit workspaces with support for plain text, markdown, assets, and attachments using OAuth authentication.
Instructions
Send message to channel
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assets | No | ||
| attachments | No | ||
| body_type | No | plain | |
| channel_id | Yes | ||
| content | No | ||
| external_asset_type | No |
Implementation Reference
- src/handlers/core.handlers.ts:21-24 (handler)The main handler function for the 'swit-message-create' tool. Validates the input arguments using MessageCreateArgsSchema and calls SwitClient.createMessage to perform the action.export const handleMessageCreate = async (switClient: SwitClient, args: any) => { const validatedArgs = MessageCreateArgsSchema.parse(args); return await switClient.createMessage(validatedArgs); };
- src/schemas.ts:67-74 (schema)Zod schema defining the input parameters for the swit-message-create tool, including channel_id, content, body_type, assets, attachments, and external_asset_type.export const MessageCreateArgsSchema = z.object({ channel_id: z.string(), content: z.string().optional(), body_type: z.enum(['plain', 'markdown']).default('plain').optional(), assets: z.array(z.any()).optional(), attachments: z.record(z.any()).optional(), external_asset_type: z.string().optional(), });
- src/tools/core.tools.ts:22-26 (registration)Tool registration in the coreTools array, specifying the name 'swit-message-create', description, and input schema derived from MessageCreateArgsSchema.{ name: 'swit-message-create', description: 'Send message to channel', inputSchema: zodToJsonSchema(MessageCreateArgsSchema), },
- src/handlers/core.handlers.ts:44-44 (registration)Maps the tool name 'swit-message-create' to the handleMessageCreate handler function within the coreHandlers factory.'swit-message-create': (args: any) => handleMessageCreate(switClient, args),
- src/swit-client.ts:62-65 (helper)The SwitClient method that implements the core logic by making a POST request to the Swit API endpoint '/api/message.create' with the validated arguments.async createMessage(args: MessageCreateArgs): Promise<MessageCreateResponse> { const response = await this.client.post('/api/message.create', args); return response.data; }