Skip to main content
Glama
vuvuvu

StreamerSongList MCP Server

by vuvuvu

monitorQueue

Monitor a streamer's song request queue for changes. Configure polling interval and monitoring duration to track queue updates.

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

  • Handler implementation for the monitorQueue tool. Polls the queue API at a configurable interval for a configurable duration, collecting timestamped snapshots of queue data including queue length. Uses a loop with setTimeout and returns all collected results as JSON.
    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 monitorQueue: accepts streamerName (string), interval (number, default 30s), and duration (number, default 300s).
    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: [],
    },
  • src/index.ts:162-165 (registration)
    Registration of all tools via ListToolsRequestSchema handler, which returns the tools array including monitorQueue.
    // Register tools
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools,
    }));
  • Alternative JS handler implementation for monitorQueue. Fetches initial queue data once and returns a simulation message indicating that real-time monitoring would use WebSocket/SSE. This is a simplified/simulation version.
    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'}`
          }]
        };
      }
    }
  • Input schema definition for monitorQueue in the JS server file. Same schema as index.ts.
      {
      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: [],
      },
    },
Behavior2/5

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

No annotations provided, so description must disclose behavioral traits. It only says 'monitor queue changes' without explaining polling behavior, blocking nature, how results are returned, 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?

Single sentence, front-loaded with the key action, no unnecessary words.

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?

For a monitoring tool with no output schema and no annotations, the description lacks information on return format, termination behavior, and error handling. It is incomplete for an agent to use confidently.

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 already provides descriptions for all parameters (100% coverage). The description adds minimal value by repeating 'configurable polling intervals' but does not clarify parameter specifics beyond the schema.

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 action (monitor), resource (queue changes), and configurable polling intervals. It distinguishes from siblings like getQueue which likely returns a static snapshot.

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?

No guidance on when to use this tool versus alternatives like getQueue. No mention of prerequisites or situations where monitoring is appropriate.

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

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