slack_post_message
Send messages to Slack channels using channel IDs and text content to facilitate team communication and notifications.
Instructions
Post a new message to a Slack channel
Input Schema
TableJSON 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)Handler function that executes the slack_post_message tool: validates input with PostMessageRequestSchema, posts message via Slack WebClient, returns success confirmation.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)Input schema definition (Zod) for the slack_post_message tool, specifying channel_id and text parameters.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)Tool registration in the ListTools response, including name, description, and input schema reference.{ name: 'slack_post_message', description: 'Post a new message to a Slack channel', inputSchema: zodToJsonSchema(PostMessageRequestSchema), },