Skip to main content
Glama

send_formatted_message

Send formatted Slack messages using Block Kit to structure content with interactive elements in specified channels or threads.

Instructions

Send a message with Block Kit formatting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYesChannel ID
textYesFallback text
blocksYesBlock Kit blocks array
thread_tsNoOptional thread timestamp to reply to

Implementation Reference

  • The core handler function for the 'send_formatted_message' tool. It validates input using Zod schema, then uses the Slack client to post a message with Block Kit blocks support.
    export async function sendFormattedMessage(client: SlackClientWrapper, args: unknown) { const params = sendFormattedMessageSchema.parse(args); return await client.safeCall(async () => { const result = await client.getClient().chat.postMessage({ channel: params.channel, text: params.text, blocks: params.blocks as any, thread_ts: params.thread_ts, }); return { ok: true, channel: result.channel, ts: result.ts, message: result.message, }; }); }
  • Zod schema used for input validation in the handler, defining parameters: channel, text, blocks (array), optional thread_ts.
    export const sendFormattedMessageSchema = z.object({ channel: channelIdSchema, text: z.string().min(1), blocks: blocksArraySchema, thread_ts: timestampSchema.optional(), });
  • src/index.ts:291-316 (registration)
    Tool metadata registration including name, description, and JSON inputSchema for the MCP list_tools endpoint.
    { name: 'send_formatted_message', description: 'Send a message with Block Kit formatting', inputSchema: { type: 'object', properties: { channel: { type: 'string', description: 'Channel ID', }, text: { type: 'string', description: 'Fallback text', }, blocks: { type: 'array', description: 'Block Kit blocks array', }, thread_ts: { type: 'string', description: 'Optional thread timestamp to reply to', }, }, required: ['channel', 'text', 'blocks'], }, },
  • src/index.ts:431-431 (registration)
    Binds the tool name to the imported handler function from messageTools for the MCP call_tool handler.
    send_formatted_message: (args) => messageTools.sendFormattedMessage(slackClient, args),

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/Hais/slack-bot-mcp'

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