Describe the bug
Using the macro #[tool_router(router = tool_router_read, vis = pub)] gives the error expected an expression. The error disappears if , vis = pub is removed.
To Reproduce
Steps to reproduce the behavior:
tree -I target output:
├── AGENTS.md
├── Cargo.lock
├── Cargo.toml
├── crush.json
├── expanded
├── README
├── sample_config.json
└── src
├── config.rs
├── lsp
│ ├── client.rs
│ └── mod.rs
├── main.rs
└── mcp
├── mod.rs
├── server.rs
└── tools
├── mod.rs
└── read.rs
- In
server.rs:
#[derive(Clone)]pubstructMCPServerConfig{pubproject_root:PathBuf,}#[derive(Clone)]pubstructMCPServer{pub(crate)tool_router:ToolRouter<Self>,pub(crate)config:MCPServerConfig,pub(crate)lsp_server:LSPServerSocket,}implMCPServer{pubfnnew(config:MCPServerConfig,lsp_server:LSPServerSocket) -> Self{Self{
config,
lsp_server,tool_router:Self::tool_router_read(),}}}#[tool_handler]implMCPServerHandlerforMCPServer{fnget_info(&self) -> ServerInfo{// ...}}- In read.rs:
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]pubstructReadToolArgs{pubpath:PathBuf,pubrange_start:usize,pubrange_end:usize,}#[derive(Debug, serde::Serialize)]pubstructReadToolOutput{pubcontent:Option<String>,pubdiagnostics:DocumentDiagnosticReportResult,}#[tool_router(router = tool_router_read, vis = pub)]// <-- error appears here, "expected an expression"implMCPServer{#[tool]pubasyncfnread(&self,Parameters(args):Parameters<ReadToolArgs>,) -> Result<CallToolResult,MCPError>{// ...}}Expected behavior
The code compiles and produces a method MCPServer::tool_router_read
Describe the bug
Using the macro
#[tool_router(router = tool_router_read, vis = pub)]gives the errorexpected an expression. The error disappears if, vis = pubis removed.To Reproduce
Steps to reproduce the behavior:
tree -I targetoutput:server.rs:Expected behavior
The code compiles and produces a method
MCPServer::tool_router_read