@@ -77,6 +77,8 @@ pub struct ToolAttribute {
7777 pub annotations : Option < ToolAnnotationsAttribute > ,
7878 /// Optional icons for the tool
7979 pub icons : Option < Expr > ,
80+ /// Optional metadata for the tool
81+ pub meta : Option < Expr > ,
8082}
8183
8284pub struct ResolvedToolAttribute {
@@ -87,6 +89,7 @@ pub struct ResolvedToolAttribute {
8789 pub output_schema : Option < Expr > ,
8890 pub annotations : Expr ,
8991 pub icons : Option < Expr > ,
92+ pub meta : Option < Expr > ,
9093}
9194
9295impl ResolvedToolAttribute {
@@ -99,6 +102,7 @@ impl ResolvedToolAttribute {
99102 output_schema,
100103 annotations,
101104 icons,
105+ meta,
102106 } = self ;
103107 let description = if let Some ( description) = description {
104108 quote ! { Some ( #description. into( ) ) }
@@ -120,6 +124,11 @@ impl ResolvedToolAttribute {
120124 } else {
121125 quote ! { None }
122126 } ;
127+ let meta = if let Some ( meta) = meta {
128+ quote ! { Some ( #meta) }
129+ } else {
130+ quote ! { None }
131+ } ;
123132 let doc_comment = format ! ( "Generated tool metadata function for {name}" ) ;
124133 let doc_attr: syn:: Attribute = parse_quote ! ( #[ doc = #doc_comment] ) ;
125134 let tokens = quote ! {
@@ -133,6 +142,7 @@ impl ResolvedToolAttribute {
133142 output_schema: #output_schema,
134143 annotations: #annotations,
135144 icons: #icons,
145+ meta: #meta,
136146 }
137147 }
138148 } ;
@@ -264,6 +274,7 @@ pub fn tool(attr: TokenStream, input: TokenStream) -> syn::Result<TokenStream> {
264274 annotations : annotations_expr,
265275 title : attribute. title ,
266276 icons : attribute. icons ,
277+ meta : attribute. meta ,
267278 } ;
268279 let tool_attr_fn = resolved_tool_attr. into_fn ( tool_attr_fn_ident) ?;
269280 // modify the the input function
0 commit comments