Skip to main content
Glama
in2out
by in2out

mattermost_send_message

Send messages to Mattermost channels using webhooks. Configure multiple channels via YAML and integrate with Claude Desktop to post notifications and updates directly to your team communication platform.

Instructions

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

Input Schema

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

Implementation Reference

  • The handler function that executes the tool: loads config, selects webhook by channel or default, sends POST request with message text to Mattermost webhook URL, handles errors, returns success message with masked URL.
    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}`); } }
  • Tool schema definition including name, description, and input schema specifying 'text' (required) and optional 'channel'.
    { name: "mattermost_send_message", description: "기본 또는 지정한 채널 웹훅으로 메시지를 전송합니다.", inputSchema: { type: "object", properties: { text: { type: "string", description: "전송할 메시지 텍스트", }, channel: { type: "string", description: "메시지를 보낼 채널명 (선택)", }, }, required: ["text"], }, },
  • index.js:131-133 (registration)
    Registration in the CallToolRequestSchema handler: switch case that invokes the sendMessage method with parsed arguments.
    case "mattermost_send_message": return await this.sendMessage(args.text, args.channel);
  • index.js:120-148 (registration)
    The overall CallToolRequestSchema handler registration, which includes the switch dispatching to mattermost_send_message.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { switch (name) { case "mattermost_list_webhooks": return await this.listWebhooks(); case "mattermost_set_default": return await this.setDefault(args.channel); case "mattermost_send_message": return await this.sendMessage(args.text, args.channel); default: throw new Error(`Unknown tool: ${name}`); } } catch (error) { return { content: [ { type: "text", text: `Error: ${error.message}`, }, ], isError: true, }; } });

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