wasmcp-macros 0.2.0

Procedural macros for the wasmcp SDK
Documentation
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, Item, ItemFn, Attribute, FnArg, Type, Pat, File};
use proc_macro2::TokenStream as TokenStream2;

/// A simpler approach - scan the entire file for tool functions and generate the Component
#[proc_macro]
pub fn generate_component(input: TokenStream) -> TokenStream {
    // This macro would be called with generate_component!();
    // It uses std::fs to read the current file and parse it
    
    // For now, return a placeholder
    quote! {
        pub struct Component;
        
        // Implementation would go here
    }.into()
}

/// Alternative: Mark individual functions as tools without needing a module wrapper
#[proc_macro_attribute]
pub fn mcp_tool(attr: TokenStream, input: TokenStream) -> TokenStream {
    let func = parse_macro_input!(input as ItemFn);
    
    // Store metadata about this tool function in a global registry
    // that generate_component!() can later read
    
    // For now, just return the function unchanged
    quote! { #func }.into()
}