getQueue
Retrieve and view current song queues for streamers with pagination support to manage and monitor song requests efficiently.
Instructions
View current song queues with pagination support
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| streamerName | No | The name of the streamer whose queue to fetch | |
| limit | No | Maximum number of songs to return (default: 50) | |
| offset | No | Number of songs to skip for pagination (default: 0) |
Implementation Reference
- src/index.ts:205-218 (handler)Handler implementation for the 'getQueue' tool. Extracts parameters (streamerName, limit, offset), fetches the queue data from the StreamerSongList API, and returns the JSON response as text content.case "getQueue": { const streamerName = getEffectiveStreamer((args as any)?.streamerName); const limit = (args as any)?.limit || 50; const offset = (args as any)?.offset || 0; const data = await makeApiRequest(`/streamers/${encodeURIComponent(streamerName)}/queue?limit=${limit}&offset=${offset}`); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:47-70 (schema)Tool schema definition for 'getQueue', including input schema with properties for streamerName, limit, and offset.{ name: "getQueue", description: "View current song queues with pagination support", inputSchema: { type: "object", properties: { streamerName: { type: "string", description: "The name of the streamer whose queue to fetch", }, limit: { type: "number", description: "Maximum number of songs to return (default: 50)", default: 50, }, offset: { type: "number", description: "Number of songs to skip for pagination (default: 0)", default: 0, }, }, required: [], }, },
- src/server.js:309-345 (handler)Handler implementation for the 'getQueue' tool in the JavaScript runtime version. Validates streamerName, fetches queue with pagination from API, handles errors, returns JSON.case "getQueue": { const { streamerName = defaultStreamer, limit = 50, offset = 0 } = args; if (!streamerName) { throw new Error( "streamerName is required. Provide a streamerName or set the DEFAULT_STREAMER environment variable." ); } try { const response = await fetch(`${API_BASE}/streamers/${encodeURIComponent(streamerName)}/queue?limit=${limit}&offset=${offset}`); if (!response.ok) { return { content: [{ type: "text", text: `Error fetching queue: ${response.status} ${response.statusText}` }] }; } const queueData = await response.json(); return { content: [{ type: "text", text: JSON.stringify(queueData, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }] }; } }
- src/server.js:142-165 (schema)Tool schema definition for 'getQueue' in JS version, matching the TS input schema.{ name: "getQueue", description: "View current song queues with pagination support", inputSchema: { type: "object", properties: { streamerName: { type: "string", description: "The name of the streamer whose queue to fetch", }, limit: { type: "number", description: "Maximum number of songs to return (default: 50)", default: 50, }, offset: { type: "number", description: "Number of songs to skip for pagination (default: 0)", default: 0, }, }, required: [], }, },
- src/index.ts:168-172 (helper)Helper function used by getQueue handler to determine the effective streamer name, falling back to config.function getEffectiveStreamer(requestedStreamer?: string): string { if (requestedStreamer) return requestedStreamer; if (defaultStreamer) return defaultStreamer; throw new Error("No streamer specified and no default streamer configured"); }