Skip to main content
Glama
in2out

Mattermost S MCP

by in2out

mattermost_send_message

Send messages to Mattermost channels using webhooks. Configure multiple channels with YAML and integrate with Claude Desktop for team communication.

Instructions

기본 또는 지정한 채널 웹훅으로 메시지를 전송합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes전송할 메시지 텍스트
channelNo메시지를 보낼 채널명 (선택)

Implementation Reference

  • The main handler function that executes the tool logic: loads config, finds appropriate webhook, sends POST request with the message text, and returns success response.
    async sendMessage(text, channel) {
      if (!text || typeof text !== "string" || !text.trim()) {
        throw new Error("text 인자가 필요합니다.");
      }
    
      const config = this.loadConfig();
      let webhook;
    
      if (channel) {
        webhook = config.webhooks.find((w) => w.channel === channel);
        if (!webhook) {
          throw new Error(`등록되지 않은 채널입니다: ${channel}`);
        }
      } else if (config.default_channel) {
        webhook = config.webhooks.find(
          (w) => w.channel === config.default_channel
        );
        if (!webhook) {
          throw new Error("기본 웹훅이 설정되어 있지 않습니다.");
        }
      } else {
        throw new Error("기본 웹훅이 설정되어 있지 않습니다.");
      }
    
      // Send webhook request
      try {
        const response = await fetch(webhook.url, {
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          body: JSON.stringify({ text }),
        });
    
        if (!response.ok) {
          throw new Error(
            `웹훅 응답 오류 ${response.status}: ${await response.text()}`
          );
        }
    
        const maskedUrl = this.maskWebhookUrl(webhook.url);
        return {
          content: [
            {
              type: "text",
              text: `채널 '${webhook.channel}' 에 메시지를 전송했습니다. (웹훅: ${maskedUrl})`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`웹훅 요청 실패: ${error.message}`);
      }
    }
  • Input schema definition for the tool, specifying 'text' as required string and optional 'channel' string.
    inputSchema: {
      type: "object",
      properties: {
        text: {
          type: "string",
          description: "전송할 메시지 텍스트",
        },
        channel: {
          type: "string",
          description: "메시지를 보낼 채널명 (선택)",
        },
      },
      required: ["text"],
    },
  • index.js:99-116 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    {
      name: "mattermost_send_message",
      description: "기본 또는 지정한 채널 웹훅으로 메시지를 전송합니다.",
      inputSchema: {
        type: "object",
        properties: {
          text: {
            type: "string",
            description: "전송할 메시지 텍스트",
          },
          channel: {
            type: "string",
            description: "메시지를 보낼 채널명 (선택)",
          },
        },
        required: ["text"],
      },
    },
  • index.js:131-132 (registration)
    Dispatcher in CallToolRequest handler that routes to the sendMessage implementation.
    case "mattermost_send_message":
      return await this.sendMessage(args.text, args.channel);
  • Helper function to obscure the webhook URL in success messages for security.
    maskWebhookUrl(url) {
      const tokenMarker = "/hooks/";
      if (url.includes(tokenMarker)) {
        const [prefix, token] = url.split(tokenMarker);
        if (token.length <= 4) {
          return `${prefix}${tokenMarker}${"*".repeat(token.length)}`;
        }
        return `${prefix}${tokenMarker}${token.substring(0, 3)}***${token.slice(
          -1
        )}`;
      }
      if (url.length <= 8) {
        return "*".repeat(url.length);
      }
      return `${url.substring(0, 4)}***${url.slice(-2)}`;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool sends messages but lacks details on permissions, rate limits, error handling, or response format. This is inadequate for a mutation tool, as it doesn't inform the agent about potential side effects or operational constraints.

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, efficient sentence that gets straight to the point without unnecessary words. It's appropriately sized for the tool's complexity, though it could be slightly more structured (e.g., by explicitly noting optional parameters).

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

Completeness2/5

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

Given the tool's mutation nature, lack of annotations, and no output schema, the description is incomplete. It doesn't explain what happens after sending (e.g., success/failure response, message ID), how defaults work, or any behavioral nuances, leaving significant gaps for an AI agent to operate effectively.

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?

The input schema has 100% description coverage, so the schema already documents both parameters ('text' and 'channel'). The description adds minimal value by implying the 'channel' parameter is optional, but this is redundant with the schema's required field list. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('send message') and resource ('via default or specified channel webhook'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'mattermost_list_webhooks' or 'mattermost_set_default', which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives (e.g., 'mattermost_set_default' for setting defaults) or any prerequisites. It mentions a 'default or specified channel webhook' but doesn't clarify how defaults are set or when to specify a channel, leaving usage context vague.

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

Install Server

Other Tools

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/in2out/mattermost-s-mcp'

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