get_stream_info
Retrieve live stream details from Twitch, including viewer count, game, and status, by providing a channel name.
Instructions
配信情報を取得します
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelName | Yes | Twitchチャンネル名 |
Implementation Reference
- src/tools/handlers/stream.ts:4-26 (handler)The handler function that implements the get_stream_info tool logic, fetching the stream status and details for a given Twitch channel using the Twitch API.export async function handleGetStreamInfo(apiClient: ApiClient, args: { channelName: string }) { const user = await getUserByName(apiClient, args.channelName); const stream = await apiClient.streams.getStreamByUserId(user.id); if (!stream) { return formatResponse({ status: 'offline', message: `${user.displayName} is currently offline`, lastOnline: null }); } return formatResponse({ status: 'online', title: stream.title, game: stream.gameName, viewers: stream.viewers, startedAt: stream.startDate, language: stream.language, thumbnailUrl: stream.thumbnailUrl, tags: stream.tags, }); }
- src/tools/definitions.ts:19-31 (schema)The tool schema definition for get_stream_info, specifying the input schema with channelName parameter.name: 'get_stream_info', description: '配信情報を取得します', inputSchema: { type: 'object', properties: { channelName: { type: 'string', description: 'Twitchチャンネル名', }, }, required: ['channelName'], }, },
- src/index.ts:91-94 (registration)The registration in the tool dispatch switch statement, mapping the tool name to its handler function.case 'get_stream_info': return await handleGetStreamInfo(this.apiClient, { channelName: args.channelName as string });