getSongDetails
Retrieve detailed information about a specific song using its unique ID, enabling access to song data within streaming platforms' request systems.
Instructions
Get detailed information about a specific song by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| streamerName | No | The name of the streamer who owns the song | |
| songId | Yes | The ID of the song to fetch details for |
Implementation Reference
- src/index.ts:289-301 (handler)The handler function for the 'getSongDetails' tool. It retrieves the streamer name (using default if not provided), extracts the songId from arguments, makes an API request to fetch the specific song details, and returns the JSON-formatted response.case "getSongDetails": { const streamerName = getEffectiveStreamer((args as any)?.streamerName); const songId = (args as any)?.songId; const data = await makeApiRequest(`/streamers/${encodeURIComponent(streamerName)}/songs/${songId}`); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- src/index.ts:143-159 (schema)The input schema and metadata definition for the 'getSongDetails' tool, including name, description, and properties for streamerName and songId.name: "getSongDetails", description: "Get detailed information about a specific song by ID", inputSchema: { type: "object", properties: { streamerName: { type: "string", description: "The name of the streamer who owns the song", }, songId: { type: "number", description: "The ID of the song to fetch details for", }, }, required: ["songId"], }, },
- src/server.js:488-541 (handler)The handler function for the 'getSongDetails' tool in the server.js implementation. It fetches the full song list for the streamer and filters locally to find the song by ID, returning its details or error messages.case "getSongDetails": { const { streamerName = defaultStreamer, songId } = args; if (!streamerName) { throw new Error( "streamerName is required. Provide a streamerName or set the DEFAULT_STREAMER environment variable." ); } if (!songId) { throw new Error("songId is required"); } try { // Get all songs and find the specific one const response = await fetch(`${API_BASE}/streamers/${encodeURIComponent(streamerName)}/songs`); if (!response.ok) { return { content: [{ type: "text", text: `Error fetching songs: ${response.status} ${response.statusText}` }] }; } const songsData = await response.json(); const allSongs = songsData.items || songsData; // Handle different response formats const song = allSongs.find(s => s.id === songId); if (!song) { return { content: [{ type: "text", text: `Song with ID ${songId} not found for streamer ${streamerName}` }] }; } return { content: [{ type: "text", text: JSON.stringify(song, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` }] }; } }
- src/server.js:238-254 (schema)The input schema and metadata definition for the 'getSongDetails' tool in server.js.name: "getSongDetails", description: "Get detailed information about a specific song by ID", inputSchema: { type: "object", properties: { streamerName: { type: "string", description: "The name of the streamer who owns the song", }, songId: { type: "number", description: "The ID of the song to fetch details for", }, }, required: ["songId"], }, },