@@ -504,7 +504,7 @@ impl ErrorData {
504504/// Represents any JSON-RPC message that can be sent or received.
505505///
506506/// This enum covers all possible message types in the JSON-RPC protocol:
507- /// individual requests/responses, notifications, batch operations, and errors.
507+ /// individual requests/responses, notifications, and errors.
508508/// It serves as the top-level message container for MCP communication.
509509#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
510510#[ serde( untagged) ]
@@ -697,6 +697,8 @@ impl Default for ClientInfo {
697697#[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
698698pub struct Implementation {
699699 pub name : String ,
700+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
701+ pub title : Option < String > ,
700702 pub version : String ,
701703}
702704
@@ -710,6 +712,7 @@ impl Implementation {
710712 pub fn from_build_env ( ) -> Self {
711713 Implementation {
712714 name : env ! ( "CARGO_CRATE_NAME" ) . to_owned ( ) ,
715+ title : None ,
713716 version : env ! ( "CARGO_PKG_VERSION" ) . to_owned ( ) ,
714717 }
715718 }
@@ -1115,6 +1118,8 @@ pub struct ResourceReference {
11151118#[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
11161119pub struct PromptReference {
11171120 pub name : String ,
1121+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1122+ pub title : Option < String > ,
11181123}
11191124
11201125const_string ! ( CompleteRequestMethod = "completion/complete" ) ;
@@ -1449,24 +1454,50 @@ pub struct GetPromptResult {
14491454
14501455macro_rules! ts_union {
14511456 (
1452- export type $U: ident =
1453- $( | ) ?$ ( $V : ident ) | * ;
1457+ export type $U: ident =
1458+ $( $rest : tt ) *
14541459 ) => {
1460+ ts_union!( @declare $U { $( $rest) * } ) ;
1461+ ts_union!( @impl_from $U { $( $rest) * } ) ;
1462+ } ;
1463+ ( @declare $U: ident { $( $variant: tt) * } ) => {
1464+ ts_union!( @declare_variant $U { } { $( $variant) * } ) ;
1465+ } ;
1466+ ( @declare_variant $U: ident { $( $declared: tt) * } { $( |) ? box $V: ident $( $rest: tt) * } ) => {
1467+ ts_union!( @declare_variant $U { $( $declared) * $V( Box <$V>) , } { $( $rest) * } ) ;
1468+ } ;
1469+ ( @declare_variant $U: ident { $( $declared: tt) * } { $( |) ? $V: ident $( $rest: tt) * } ) => {
1470+ ts_union!( @declare_variant $U { $( $declared) * $V( $V) , } { $( $rest) * } ) ;
1471+ } ;
1472+ ( @declare_variant $U: ident { $( $declared: tt) * } { ; } ) => {
1473+ ts_union!( @declare_end $U { $( $declared) * } ) ;
1474+ } ;
1475+ ( @declare_end $U: ident { $( $declared: tt) * } ) => {
14551476 #[ derive( Debug , Serialize , Deserialize , Clone ) ]
14561477 #[ serde( untagged) ]
14571478 #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
14581479 pub enum $U {
1459- $( $V ( $V ) , ) *
1480+ $( $declared ) *
14601481 }
1461-
1462- $(
1463- impl From <$V> for $U {
1464- fn from( value: $V) -> Self {
1465- $U:: $V( value)
1466- }
1482+ } ;
1483+ ( @impl_from $U: ident { $( |) ? box $V: ident $( $rest: tt) * } ) => {
1484+ impl From <$V> for $U {
1485+ fn from( value: $V) -> Self {
1486+ $U:: $V( Box :: new( value) )
14671487 }
1468- ) *
1488+ }
1489+ ts_union!( @impl_from $U { $( $rest) * } ) ;
1490+ } ;
1491+ ( @impl_from $U: ident { $( |) ? $V: ident $( $rest: tt) * } ) => {
1492+ impl From <$V> for $U {
1493+ fn from( value: $V) -> Self {
1494+ $U:: $V( value)
1495+ }
1496+ }
1497+ ts_union!( @impl_from $U { $( $rest) * } ) ;
14691498 } ;
1499+ ( @impl_from $U: ident { ; } ) => { } ;
1500+ ( @impl_from $U: ident { } ) => { } ;
14701501}
14711502
14721503ts_union ! (
@@ -1515,7 +1546,7 @@ ts_union!(
15151546) ;
15161547
15171548ts_union ! (
1518- export type ClientResult = CreateMessageResult | ListRootsResult | CreateElicitationResult | EmptyResult ;
1549+ export type ClientResult = box CreateMessageResult | ListRootsResult | CreateElicitationResult | EmptyResult ;
15191550) ;
15201551
15211552impl ClientResult {
0 commit comments