slack_post_message
Post a message to a Slack channel using its channel ID and text content. Send notifications directly to any channel.
Instructions
Post a new message to a Slack channel
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | The ID of the channel to post to | |
| text | Yes | The message text to post |
Implementation Reference
- src/index.ts:205-217 (handler)The handler for 'slack_post_message' tool. Parses the request arguments with PostMessageRequestSchema, calls slackClient.chat.postMessage with channel_id and text, and returns a success message.
case 'slack_post_message': { const args = PostMessageRequestSchema.parse(request.params.arguments); const response = await slackClient.chat.postMessage({ channel: args.channel_id, text: args.text, }); if (!response.ok) { throw new Error(`Failed to post message: ${response.error}`); } return { content: [{ type: 'text', text: 'Message posted successfully' }], }; } - src/schemas.ts:199-202 (schema)Zod schema defining the input for slack_post_message: channel_id (string) and text (string).
export const PostMessageRequestSchema = z.object({ channel_id: z.string().describe('The ID of the channel to post to'), text: z.string().describe('The message text to post'), }); - src/index.ts:121-125 (registration)Registration of the 'slack_post_message' tool in the ListTools handler, including its description and input schema.
{ name: 'slack_post_message', description: 'Post a new message to a Slack channel', inputSchema: zodToJsonSchema(PostMessageRequestSchema), },