@@ -66,6 +66,8 @@ fn extract_schema_from_return_type(ret_type: &syn::Type) -> Option<Expr> {
6666pub struct ToolAttribute {
6767 /// The name of the tool
6868 pub name : Option < String > ,
69+ /// Human readable title of tool
70+ pub title : Option < String > ,
6971 pub description : Option < String > ,
7072 /// A JSON Schema object defining the expected parameters for the tool
7173 pub input_schema : Option < Expr > ,
@@ -77,6 +79,7 @@ pub struct ToolAttribute {
7779
7880pub struct ResolvedToolAttribute {
7981 pub name : String ,
82+ pub title : Option < String > ,
8083 pub description : Option < String > ,
8184 pub input_schema : Expr ,
8285 pub output_schema : Option < Expr > ,
@@ -88,6 +91,7 @@ impl ResolvedToolAttribute {
8891 let Self {
8992 name,
9093 description,
94+ title,
9195 input_schema,
9296 output_schema,
9397 annotations,
@@ -102,10 +106,16 @@ impl ResolvedToolAttribute {
102106 } else {
103107 quote ! { None }
104108 } ;
109+ let title = if let Some ( title) = title {
110+ quote ! { Some ( #title. into( ) ) }
111+ } else {
112+ quote ! { None }
113+ } ;
105114 let tokens = quote ! {
106115 pub fn #fn_ident( ) -> rmcp:: model:: Tool {
107116 rmcp:: model:: Tool {
108117 name: #name. into( ) ,
118+ title: #title,
109119 description: #description,
110120 input_schema: #input_schema,
111121 output_schema: #output_schema,
@@ -229,6 +239,7 @@ pub fn tool(attr: TokenStream, input: TokenStream) -> syn::Result<TokenStream> {
229239 input_schema : input_schema_expr,
230240 output_schema : output_schema_expr,
231241 annotations : annotations_expr,
242+ title : attribute. title ,
232243 } ;
233244 let tool_attr_fn = resolved_tool_attr. into_fn ( tool_attr_fn_ident) ?;
234245 // modify the the input function
0 commit comments