@@ -58,6 +58,9 @@ pub struct EmptyObject {}
5858
5959pub trait ConstString : Default {
6060 const VALUE : & str ;
61+ fn as_str ( & self ) -> & ' static str {
62+ Self :: VALUE
63+ }
6164}
6265#[ macro_export]
6366macro_rules! const_string {
@@ -1491,6 +1494,26 @@ ts_union!(
14911494 | ListToolsRequest ;
14921495) ;
14931496
1497+ impl ClientRequest {
1498+ pub fn method ( & self ) -> & ' static str {
1499+ match & self {
1500+ ClientRequest :: PingRequest ( r) => r. method . as_str ( ) ,
1501+ ClientRequest :: InitializeRequest ( r) => r. method . as_str ( ) ,
1502+ ClientRequest :: CompleteRequest ( r) => r. method . as_str ( ) ,
1503+ ClientRequest :: SetLevelRequest ( r) => r. method . as_str ( ) ,
1504+ ClientRequest :: GetPromptRequest ( r) => r. method . as_str ( ) ,
1505+ ClientRequest :: ListPromptsRequest ( r) => r. method . as_str ( ) ,
1506+ ClientRequest :: ListResourcesRequest ( r) => r. method . as_str ( ) ,
1507+ ClientRequest :: ListResourceTemplatesRequest ( r) => r. method . as_str ( ) ,
1508+ ClientRequest :: ReadResourceRequest ( r) => r. method . as_str ( ) ,
1509+ ClientRequest :: SubscribeRequest ( r) => r. method . as_str ( ) ,
1510+ ClientRequest :: UnsubscribeRequest ( r) => r. method . as_str ( ) ,
1511+ ClientRequest :: CallToolRequest ( r) => r. method . as_str ( ) ,
1512+ ClientRequest :: ListToolsRequest ( r) => r. method . as_str ( ) ,
1513+ }
1514+ }
1515+ }
1516+
14941517ts_union ! (
14951518 export type ClientNotification =
14961519 | CancelledNotification
0 commit comments