Skip to main content
Glama
zencoderai

Slack

by zencoderai

slack_post_message

Send messages to Slack channels or direct messages using channel IDs and text content. This tool enables automated communication within Slack workspaces through API integration.

Instructions

Post a new message to a Slack channel or direct message to user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYesThe ID of the channel or user to post to
textYesThe message text to post

Implementation Reference

  • index.ts:248-264 (registration)
    Registration of the slack_post_message MCP tool, including title, description, input schema, and handler function that delegates to SlackClient.postMessage.
    server.registerTool( "slack_post_message", { title: "Post Slack Message", description: "Post a new message to a Slack channel or direct message to user", inputSchema: { channel_id: z.string().describe("The ID of the channel or user to post to"), text: z.string().describe("The message text to post"), }, }, async ({ channel_id, text }) => { const response = await slackClient.postMessage(channel_id, text); return { content: [{ type: "text", text: JSON.stringify(response) }], }; } );
  • The core handler function in SlackClient that executes the Slack API call to post a message using chat.postMessage endpoint.
    async postMessage(channel_id: string, text: string): Promise<any> { const response = await fetch("https://slack.com/api/chat.postMessage", { method: "POST", headers: this.botHeaders, body: JSON.stringify({ channel: channel_id, text: text, }), }); return response.json(); }
  • Zod input schema definition for the tool parameters: channel_id and text.
    inputSchema: { channel_id: z.string().describe("The ID of the channel or user to post to"), text: z.string().describe("The message text to post"), },

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/zencoderai/slack-mcp-server'

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