Skip to main content
Glama

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
NameRequiredDescriptionDefault
assetsNo
attachmentsNo
body_typeNoplain
channel_idYes
contentNo
external_asset_typeNo

Implementation Reference

  • 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); };
  • 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(), });
  • 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), },
  • Maps the tool name 'swit-message-create' to the handleMessageCreate handler function within the coreHandlers factory.
    'swit-message-create': (args: any) => handleMessageCreate(switClient, args),
  • 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; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TykanN/swit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server