Skip to main content
Glama
z9905080

MCP Server for Slack

by z9905080

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
NameRequiredDescriptionDefault
channel_idYesThe ID of the channel to post to
textYesThe message text to post

Implementation Reference

  • Executes the slack_post_message tool by validating input arguments and invoking the SlackClient.postMessage method to send the message.
    case "slack_post_message": {
      const args = request.params.arguments as unknown as PostMessageArgs;
      if (!args.channel_id || !args.text) {
        throw new Error(
          "Missing required arguments: channel_id and text",
        );
      }
      const response = await slackClient.postMessage(
        args.channel_id,
        args.text,
      );
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Defines the input schema and metadata for the slack_post_message tool.
    const postMessageTool: Tool = {
      name: "slack_post_message",
      description: "Post a new message to a Slack channel",
      inputSchema: {
        type: "object",
        properties: {
          channel_id: {
            type: "string",
            description: "The ID of the channel to post to",
          },
          text: {
            type: "string",
            description: "The message text to post",
          },
        },
        required: ["channel_id", "text"],
      },
    };
  • index.ts:567-582 (registration)
    Registers the slack_post_message tool (as postMessageTool) in the ListTools response.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.log("Received ListToolsRequest");
      return {
        tools: [
          listChannelsTool,
          postMessageTool,
          replyToThreadTool,
          addReactionTool,
          getChannelHistoryTool,
          getThreadRepliesTool,
          getUsersTool,
          getUserProfileTool,
          lookupUserByEmailTool,
        ],
      };
    });
  • SlackClient helper method that performs the HTTP POST to Slack's chat.postMessage API 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();
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; the description only states the action. It does not disclose required permissions (scopes), whether the message is plain text or supports markdown, or any side effects like rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with no wasted words. It is sufficiently concise but could benefit from a slightly structured format.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with 2 parameters and no output schema, the description is minimal. It lacks information about the return value (e.g., message ID) and error cases, but is acceptable for basic usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions for both parameters. The description adds no extra meaning beyond what the schema provides, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (Post), resource (new message), and target (Slack channel). It distinguishes from siblings like slack_reply_to_thread and slack_add_reaction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., reply vs post, or when formatting is supported). The description lacks context about prerequisites or use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.