Skip to main content
Glama
in2out
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)}`; }

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