22
33from mcp import types
44
5- from .miku import MikuService
5+ from .live_streaming import LiveStreamingService
66from ...consts import consts
77from ...tools import tools
88
99logger = logging .getLogger (consts .LOGGER_NAME )
1010
11- _BUCKET_DESC = "Miku bucket name"
12- _STREAM_DESC = "Miku stream name"
11+ _BUCKET_DESC = "LiveStreaming bucket name"
12+ _STREAM_DESC = "LiveStreaming stream name"
1313
1414
1515class _ToolImpl :
16- def __init__ (self , miku : MikuService ):
17- self .miku = miku
16+ def __init__ (self , live_streaming : LiveStreamingService ):
17+ self .live_streaming = live_streaming
1818
1919 @tools .tool_meta (
2020 types .Tool (
21- name = "miku_create_bucket " ,
22- description = "Create a new bucket in Miku using S3-style API. The bucket will be created at https://<bucket>.<endpoint_url>" ,
21+ name = "live_streaming_create_bucket " ,
22+ description = "Create a new bucket in LiveStreaming using S3-style API. The bucket will be created at https://<bucket>.<endpoint_url>" ,
2323 inputSchema = {
2424 "type" : "object" ,
2525 "properties" : {
@@ -33,13 +33,13 @@ def __init__(self, miku: MikuService):
3333 )
3434 )
3535 async def create_bucket (self , ** kwargs ) -> list [types .TextContent ]:
36- result = await self .miku .create_bucket (** kwargs )
36+ result = await self .live_streaming .create_bucket (** kwargs )
3737 return [types .TextContent (type = "text" , text = str (result ))]
3838
3939 @tools .tool_meta (
4040 types .Tool (
41- name = "miku_create_stream " ,
42- description = "Create a new stream in Miku using S3-style API. The stream will be created at https://<bucket>.<endpoint_url>/<stream>" ,
41+ name = "live_streaming_create_stream " ,
42+ description = "Create a new stream in LiveStreaming using S3-style API. The stream will be created at https://<bucket>.<endpoint_url>/<stream>" ,
4343 inputSchema = {
4444 "type" : "object" ,
4545 "properties" : {
@@ -57,13 +57,13 @@ async def create_bucket(self, **kwargs) -> list[types.TextContent]:
5757 )
5858 )
5959 async def create_stream (self , ** kwargs ) -> list [types .TextContent ]:
60- result = await self .miku .create_stream (** kwargs )
60+ result = await self .live_streaming .create_stream (** kwargs )
6161 return [types .TextContent (type = "text" , text = str (result ))]
6262
6363 @tools .tool_meta (
6464 types .Tool (
65- name = "miku_bind_push_domain " ,
66- description = "Bind a push domain to a Miku bucket for live streaming. This allows you to configure the domain for pushing RTMP/WHIP streams." ,
65+ name = "live_streaming_bind_push_domain " ,
66+ description = "Bind a push domain to a LiveStreaming bucket for live streaming. This allows you to configure the domain for pushing RTMP/WHIP streams." ,
6767 inputSchema = {
6868 "type" : "object" ,
6969 "properties" : {
@@ -86,13 +86,13 @@ async def create_stream(self, **kwargs) -> list[types.TextContent]:
8686 )
8787 )
8888 async def bind_push_domain (self , ** kwargs ) -> list [types .TextContent ]:
89- result = await self .miku .bind_push_domain (** kwargs )
89+ result = await self .live_streaming .bind_push_domain (** kwargs )
9090 return [types .TextContent (type = "text" , text = str (result ))]
9191
9292 @tools .tool_meta (
9393 types .Tool (
94- name = "miku_bind_play_domain " ,
95- description = "Bind a playback domain to a Miku bucket for live streaming. This allows you to configure the domain for playing back streams via FLV/M3U8/WHEP." ,
94+ name = "live_streaming_bind_play_domain " ,
95+ description = "Bind a playback domain to a LiveStreaming bucket for live streaming. This allows you to configure the domain for playing back streams via FLV/M3U8/WHEP." ,
9696 inputSchema = {
9797 "type" : "object" ,
9898 "properties" : {
@@ -115,12 +115,12 @@ async def bind_push_domain(self, **kwargs) -> list[types.TextContent]:
115115 )
116116 )
117117 async def bind_play_domain (self , ** kwargs ) -> list [types .TextContent ]:
118- result = await self .miku .bind_play_domain (** kwargs )
118+ result = await self .live_streaming .bind_play_domain (** kwargs )
119119 return [types .TextContent (type = "text" , text = str (result ))]
120120
121121 @tools .tool_meta (
122122 types .Tool (
123- name = "miku_get_push_urls " ,
123+ name = "live_streaming_get_push_urls " ,
124124 description = "Get push URLs for a stream. Returns RTMP and WHIP push URLs that can be used to push live streams." ,
125125 inputSchema = {
126126 "type" : "object" ,
@@ -143,12 +143,12 @@ async def bind_play_domain(self, **kwargs) -> list[types.TextContent]:
143143 )
144144 )
145145 async def get_push_urls (self , ** kwargs ) -> list [types .TextContent ]:
146- result = self .miku .get_push_urls (** kwargs )
146+ result = self .live_streaming .get_push_urls (** kwargs )
147147 return [types .TextContent (type = "text" , text = str (result ))]
148148
149149 @tools .tool_meta (
150150 types .Tool (
151- name = "miku_get_play_urls " ,
151+ name = "live_streaming_get_play_urls " ,
152152 description = "Get playback URLs for a stream. Returns FLV, M3U8, and WHEP playback URLs that can be used to play live streams." ,
153153 inputSchema = {
154154 "type" : "object" ,
@@ -171,12 +171,12 @@ async def get_push_urls(self, **kwargs) -> list[types.TextContent]:
171171 )
172172 )
173173 async def get_play_urls (self , ** kwargs ) -> list [types .TextContent ]:
174- result = self .miku .get_play_urls (** kwargs )
174+ result = self .live_streaming .get_play_urls (** kwargs )
175175 return [types .TextContent (type = "text" , text = str (result ))]
176176
177177 @tools .tool_meta (
178178 types .Tool (
179- name = "miku_query_live_traffic_stats " ,
179+ name = "live_streaming_query_live_traffic_stats " ,
180180 description = "Query live streaming traffic statistics for a time range. Returns bandwidth and traffic usage data." ,
181181 inputSchema = {
182182 "type" : "object" ,
@@ -195,12 +195,12 @@ async def get_play_urls(self, **kwargs) -> list[types.TextContent]:
195195 )
196196 )
197197 async def query_live_traffic_stats (self , ** kwargs ) -> list [types .TextContent ]:
198- result = await self .miku .query_live_traffic_stats (** kwargs )
198+ result = await self .live_streaming .query_live_traffic_stats (** kwargs )
199199 return [types .TextContent (type = "text" , text = str (result ))]
200200
201201
202- def register_tools (miku : MikuService ):
203- tool_impl = _ToolImpl (miku )
202+ def register_tools (live_streaming : LiveStreamingService ):
203+ tool_impl = _ToolImpl (live_streaming )
204204 tools .auto_register_tools (
205205 [
206206 tool_impl .create_bucket ,
0 commit comments