Skip to main content
Glama
Stig-Johnny

Slack Notifications MCP Server

by Stig-Johnny

check_build_status

Retrieve recent Xcode Cloud build status from Slack notifications, including workflow name, duration, and timestamp. Filter by workflow for specific builds.

Instructions

Get the latest Xcode Cloud build status from Slack notifications. Returns recent build messages including status, workflow name, duration, and timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of recent build messages to retrieve (default: 5, max: 20)
workflowNoFilter by workflow name (e.g., 'Cuti-E-Admin', 'Nutri-E'). Case-insensitive partial match.

Implementation Reference

  • index.js:49-66 (registration)
    Registration of the check_build_status tool in the ListToolsRequestSchema handler, defining its name, description, and input schema.
    {
      name: "check_build_status",
      description: "Get the latest Xcode Cloud build status from Slack notifications. Returns recent build messages including status, workflow name, duration, and timestamp.",
      inputSchema: {
        type: "object",
        properties: {
          limit: {
            type: "number",
            description: "Number of recent build messages to retrieve (default: 5, max: 20)",
            default: 5,
          },
          workflow: {
            type: "string",
            description: "Filter by workflow name (e.g., 'Cuti-E-Admin', 'Nutri-E'). Case-insensitive partial match.",
          },
        },
        required: [],
      },
  • Input schema for check_build_status: optional 'limit' (number, default 5, max 20) and optional 'workflow' (string for filtering by workflow name).
    inputSchema: {
      type: "object",
      properties: {
        limit: {
          type: "number",
          description: "Number of recent build messages to retrieve (default: 5, max: 20)",
          default: 5,
        },
        workflow: {
          type: "string",
          description: "Filter by workflow name (e.g., 'Cuti-E-Admin', 'Nutri-E'). Case-insensitive partial match.",
        },
      },
      required: [],
    },
  • Handler implementation for check_build_status: fetches Slack channel history from the build channel, parses Xcode Cloud build notification messages to extract status (succeeded/failed/running/cancelled), workflow name, duration, and timestamp, with optional workflow filtering and limit control.
    case "check_build_status": {
      if (!buildChannelId) {
        return {
          content: [
            {
              type: "text",
              text: "Error: SLACK_BUILD_CHANNEL_ID not configured. Please set it in your MCP config.",
            },
          ],
        };
      }
    
      const workflowFilter = args?.workflow?.toLowerCase();
      // Fetch more messages if filtering, to ensure we get enough matches
      const fetchLimit = workflowFilter ? Math.min((args?.limit || 5) * 4, 100) : Math.min(args?.limit || 5, 20);
      const result = await slack.conversations.history({
        channel: buildChannelId,
        limit: fetchLimit,
      });
    
      if (!result.messages || result.messages.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: "No build messages found in the channel.",
            },
          ],
        };
      }
    
      // Helper function to extract duration from text
      const extractDuration = (text, attachments) => {
        // Common patterns for duration in Xcode Cloud messages
        const patterns = [
          /duration[:\s]+(\d+)\s*(?:min(?:ute)?s?)?(?:\s*(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
          /took\s+(\d+)\s*(?:min(?:ute)?s?)?(?:\s*(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
          /completed\s+in\s+(\d+)\s*(?:min(?:ute)?s?)?(?:\s*(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
          /(\d+)\s*(?:min(?:ute)?s?)\s*(?:(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
          /(\d+):(\d+)\s*(?:min)?/i, // MM:SS format
        ];
    
        const allText = text + ' ' + (attachments?.map(a => `${a.title || ''} ${a.text || ''}`).join(' ') || '');
    
        for (const pattern of patterns) {
          const match = allText.match(pattern);
          if (match) {
            const mins = parseInt(match[1]) || 0;
            const secs = parseInt(match[2]) || 0;
            const totalSeconds = mins * 60 + secs;
            return {
              minutes: mins,
              seconds: secs,
              totalSeconds,
              formatted: mins > 0 ? `${mins}m ${secs}s` : `${secs}s`,
            };
          }
        }
        return null;
      };
    
      // Helper function to extract workflow name
      const extractWorkflow = (text, attachments) => {
        // Look for workflow name in text or attachments
        const allText = text + ' ' + (attachments?.map(a => `${a.title || ''} ${a.text || ''}`).join(' ') || '');
    
        // Common patterns: "Workflow: Name", title of attachment often contains workflow
        const patterns = [
          /workflow[:\s]+([^\n\r,]+)/i,
          /^([A-Z][a-zA-Z0-9-]+(?:\s+[A-Z][a-zA-Z0-9-]+)*)\s+(?:build|workflow)/i,
        ];
    
        for (const pattern of patterns) {
          const match = allText.match(pattern);
          if (match) {
            return match[1].trim();
          }
        }
    
        // Check attachment titles - often contains workflow name
        if (attachments && attachments.length > 0) {
          const title = attachments[0].title;
          if (title && title.length > 0 && title.length < 50) {
            return title;
          }
        }
    
        return null;
      };
    
      // Parse build messages - Xcode Cloud messages have specific format
      let buildMessages = result.messages.map((msg) => {
        const timestamp = new Date(parseFloat(msg.ts) * 1000).toISOString();
    
        // Try to extract build status from message
        let status = "unknown";
        const text = msg.text || "";
    
        if (text.toLowerCase().includes("succeeded") || text.toLowerCase().includes("success")) {
          status = "succeeded";
        } else if (text.toLowerCase().includes("failed") || text.toLowerCase().includes("failure")) {
          status = "failed";
        } else if (text.toLowerCase().includes("started") || text.toLowerCase().includes("running")) {
          status = "running";
        } else if (text.toLowerCase().includes("cancelled") || text.toLowerCase().includes("canceled")) {
          status = "cancelled";
        }
    
        const workflow = extractWorkflow(text, msg.attachments);
        const duration = extractDuration(text, msg.attachments);
    
        return {
          timestamp,
          status,
          workflow,
          duration,
          text: text.substring(0, 500), // Truncate long messages
          attachments: msg.attachments?.map(a => ({
            title: a.title,
            text: a.text?.substring(0, 200),
            color: a.color,
          })),
        };
      });
    
      // Apply workflow filter if specified
      if (workflowFilter) {
        buildMessages = buildMessages.filter((msg) => {
          const workflow = msg.workflow?.toLowerCase() || '';
          const text = msg.text?.toLowerCase() || '';
          const attachmentText = msg.attachments?.map(a => `${a.title || ''} ${a.text || ''}`).join(' ').toLowerCase() || '';
          return workflow.includes(workflowFilter) || text.includes(workflowFilter) || attachmentText.includes(workflowFilter);
        });
      }
    
      // Apply limit after filtering
      const limit = Math.min(args?.limit || 5, 20);
      buildMessages = buildMessages.slice(0, limit);
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              builds: buildMessages,
              filter: workflowFilter ? { workflow: args.workflow } : null,
              count: buildMessages.length,
            }, null, 2),
          },
        ],
      };
    }
  • Helper function extractDuration: parses duration text from Xcode Cloud build messages using multiple regex patterns to extract minutes and seconds.
    const extractDuration = (text, attachments) => {
      // Common patterns for duration in Xcode Cloud messages
      const patterns = [
        /duration[:\s]+(\d+)\s*(?:min(?:ute)?s?)?(?:\s*(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
        /took\s+(\d+)\s*(?:min(?:ute)?s?)?(?:\s*(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
        /completed\s+in\s+(\d+)\s*(?:min(?:ute)?s?)?(?:\s*(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
        /(\d+)\s*(?:min(?:ute)?s?)\s*(?:(\d+)\s*(?:sec(?:ond)?s?)?)?/i,
        /(\d+):(\d+)\s*(?:min)?/i, // MM:SS format
      ];
    
      const allText = text + ' ' + (attachments?.map(a => `${a.title || ''} ${a.text || ''}`).join(' ') || '');
    
      for (const pattern of patterns) {
        const match = allText.match(pattern);
        if (match) {
          const mins = parseInt(match[1]) || 0;
          const secs = parseInt(match[2]) || 0;
          const totalSeconds = mins * 60 + secs;
          return {
            minutes: mins,
            seconds: secs,
            totalSeconds,
            formatted: mins > 0 ? `${mins}m ${secs}s` : `${secs}s`,
          };
        }
      }
      return null;
    };
  • Helper function extractWorkflow: parses workflow name from Xcode Cloud build messages using regex patterns and attachment titles.
    const extractWorkflow = (text, attachments) => {
      // Look for workflow name in text or attachments
      const allText = text + ' ' + (attachments?.map(a => `${a.title || ''} ${a.text || ''}`).join(' ') || '');
    
      // Common patterns: "Workflow: Name", title of attachment often contains workflow
      const patterns = [
        /workflow[:\s]+([^\n\r,]+)/i,
        /^([A-Z][a-zA-Z0-9-]+(?:\s+[A-Z][a-zA-Z0-9-]+)*)\s+(?:build|workflow)/i,
      ];
    
      for (const pattern of patterns) {
        const match = allText.match(pattern);
        if (match) {
          return match[1].trim();
        }
      }
    
      // Check attachment titles - often contains workflow name
      if (attachments && attachments.length > 0) {
        const title = attachments[0].title;
        if (title && title.length > 0 && title.length < 50) {
          return title;
        }
      }
    
      return null;
    };
Behavior2/5

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

No annotations are provided, so the description carries full burden. It indicates a read-like operation ('get') but does not explicitly state it is safe or non-destructive. Missing details on permissions, rate limits, or side effects.

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

Conciseness5/5

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

The description is two sentences, front-loaded with the tool's purpose, and efficient with no waste. Every sentence adds value.

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

Completeness4/5

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

Given 100% schema coverage and simple parameters, the description is fairly complete. It lists return fields (status, workflow, duration, timestamp) but could clarify ordering (e.g., 'latest' meaning most recent) or mention that it filters specifically for Xcode Cloud notifications.

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 description coverage is 100%, and parameters are well-described in the schema (limit with default/max, workflow with case-insensitive partial match). The description adds no additional meaning beyond the schema, so baseline 3.

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 tool gets the latest Xcode Cloud build status from Slack notifications and specifies the return fields (status, workflow name, duration, timestamp). It distinguishes from sibling tools like get_channel_messages or search_messages, which are general Slack operations.

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

Usage Guidelines3/5

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

The description implies usage for retrieving Xcode Cloud build notifications but does not explicitly state when to use it versus alternatives or provide exclusions (e.g., not for general messages). No guidance on prerequisites or when not to use.

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/Stig-Johnny/slack-notifications-mcp'

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