Skip to main content
Glama
vuvuvu

StreamerSongList MCP Server

by vuvuvu

monitorQueue

Monitor song queue changes for streamers with configurable polling intervals to track request updates in real-time.

Instructions

Monitor queue changes with configurable polling intervals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
streamerNameNoThe name of the streamer whose queue to monitor
intervalNoPolling interval in seconds (default: 30)
durationNoHow long to monitor in seconds (default: 300)

Implementation Reference

  • Simulation-based handler for the monitorQueue tool. Fetches initial queue state and returns monitoring setup information, noting that real-time updates would require WebSocket/SSE.
    case "monitorQueue": {
    
      const { streamerName = defaultStreamer, interval = 30, duration = 300 } = args;
    
      if (!streamerName) {
        throw new Error(
          "streamerName is required. Provide a streamerName or set the DEFAULT_STREAMER environment variable."
        );
      }
      
      try {
        const updates = [];
        
        // Initial queue fetch
        const initialResponse = await fetch(`https://api.streamersonglist.com/v1/streamers/${encodeURIComponent(streamerName)}/queue`);
        if (initialResponse.ok) {
          const initialQueue = await initialResponse.json();
          updates.push({
            timestamp: new Date().toISOString(),
            type: 'initial',
            data: initialQueue
          });
        }
        
        const monitoringId = `monitor_${streamerName}_${Date.now()}`;
        
        return {
          content: [{
            type: "text",
            text: `Started monitoring queue for ${streamerName}\n` +
                  `Monitoring ID: ${monitoringId}\n` +
                  `Interval: ${interval} seconds\n` +
                  `Duration: ${duration} seconds\n` +
                  `\nNote: This is a simulation. In a real implementation, this would:\n` +
                  `- Establish WebSocket or SSE connection\n` +
                  `- Subscribe to queue updates for the streamer\n` +
                  `- Send real-time notifications of queue changes\n` +
                  `\nInitial queue data:\n${JSON.stringify(updates, null, 2)}`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error setting up monitoring: ${error instanceof Error ? error.message : 'Unknown error'}`
          }]
        };
      }
    }
  • Polling-based implementation of monitorQueue handler that periodically fetches the queue for the specified duration and collects results including timestamps and queue lengths.
    case "monitorQueue": {
      const streamerName = getEffectiveStreamer((args as any)?.streamerName);
      const interval = ((args as any)?.interval || 30) * 1000; // Convert to milliseconds
      const duration = ((args as any)?.duration || 300) * 1000; // Convert to milliseconds
      
      const startTime = Date.now();
      const results: any[] = [];
      
      while (Date.now() - startTime < duration) {
        try {
          const data = await makeApiRequest(`/streamers/${encodeURIComponent(streamerName)}/queue`);
          results.push({
            timestamp: new Date().toISOString(),
            queueLength: data.list?.length || 0,
            data: data,
          });
          
          if (Date.now() - startTime + interval < duration) {
            await new Promise(resolve => setTimeout(resolve, interval));
          }
        } catch (error: any) {
          results.push({
            timestamp: new Date().toISOString(),
            error: error.message,
          });
          break;
        }
      }
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the monitorQueue tool, specifying parameters for streamerName, interval, and duration.
      {
      name: "monitorQueue",
      description: "Monitor queue changes with configurable polling intervals",
      inputSchema: {
        type: "object",
        properties: {
          streamerName: {
            type: "string",
            description: "The name of the streamer whose queue to monitor",
          },
          interval: {
            type: "number",
            description: "Polling interval in seconds (default: 30)",
            default: 30,
          },
          duration: {
            type: "number",
            description: "How long to monitor in seconds (default: 300)",
            default: 300,
          },
        },
        required: [],
      },
    },
  • Input schema for the monitorQueue tool in the TypeScript implementation.
    {
      name: "monitorQueue",
      description: "Monitor queue changes with configurable polling intervals",
      inputSchema: {
        type: "object",
        properties: {
          streamerName: {
            type: "string",
            description: "The name of the streamer whose queue to monitor",
          },
          interval: {
            type: "number",
            description: "Polling interval in seconds (default: 30)",
            default: 30,
          },
          duration: {
            type: "number",
            description: "How long to monitor in seconds (default: 300)",
            default: 300,
          },
        },
        required: [],
      },
    },

Tool Definition Quality

Score is being calculated. Check back soon.

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/vuvuvu/streamersonglist-mcp'

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