File tree Expand file tree Collapse file tree 4 files changed +17
-24
lines changed
examples/servers/src/common Expand file tree Collapse file tree 4 files changed +17
-24
lines changed Original file line number Diff line number Diff line change @@ -99,22 +99,13 @@ jobs:
9999 - name : Install Rust
100100 uses : dtolnay/rust-toolchain@stable
101101
102- - name : Cache dependencies
103- uses : actions/cache@v3
104- with :
105- path : |
106- ~/.cargo/registry
107- ~/.cargo/git
108- target
109- key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
110- restore-keys : ${{ runner.os }}-cargo-
102+ - uses : Swatinem/rust-cache@v2
111103
112104 - name : Generate documentation
113105 run : |
114106 cargo doc --no-deps -p rmcp -p rmcp-macros
115- # there must be no warnings , doc hasn't been fix yet, so skip it
116- # env:
117- # RUSTDOCFLAGS: -Dwarnings
107+ env :
108+ RUSTDOCFLAGS : -Dwarnings
118109
119110 release :
120111 name : Release crates
Original file line number Diff line number Diff line change @@ -24,9 +24,13 @@ Start a client in one line:
2424use rmcp :: {ServiceExt , transport :: TokioChildProcess };
2525use tokio :: process :: Command ;
2626
27- let client = (). serve (
28- TokioChildProcess :: new (Command :: new (" npx" ). arg (" -y" ). arg (" @modelcontextprotocol/server-everything" ))?
29- ). await ? ;
27+ #[tokio:: main]
28+ async fn main () -> Result <(), Box <dyn std :: error :: Error >> {
29+ let client = (). serve (
30+ TokioChildProcess :: new (Command :: new (" npx" ). arg (" -y" ). arg (" @modelcontextprotocol/server-everything" ))?
31+ ). await ? ;
32+ Ok (())
33+ }
3034```
3135
3236#### 1. Build a transport
Original file line number Diff line number Diff line change 1- #![ doc = include_str ! ( "../../../README.md" ) ]
21mod error;
32pub use error:: Error ;
43
Original file line number Diff line number Diff line change @@ -164,14 +164,13 @@ impl ServerHandler for Counter {
164164 match name. as_str ( ) {
165165 "example_prompt" => {
166166 let message = arguments
167- . and_then (
168- |json|
169- json. get ( "message" )
170- ?. as_str ( )
171- . map ( |s| s. to_string ( ) ) )
172- . ok_or_else ( || McpError :: invalid_params ( "No message provided to example_prompt" , None ) ) ?;
173-
174- let prompt = format ! ( "This is an example prompt with your message here: '{message}'" ) ;
167+ . and_then ( |json| json. get ( "message" ) ?. as_str ( ) . map ( |s| s. to_string ( ) ) )
168+ . ok_or_else ( || {
169+ McpError :: invalid_params ( "No message provided to example_prompt" , None )
170+ } ) ?;
171+
172+ let prompt =
173+ format ! ( "This is an example prompt with your message here: '{message}'" ) ;
175174 Ok ( GetPromptResult {
176175 description : None ,
177176 messages : vec ! [ PromptMessage {
You can’t perform that action at this time.
0 commit comments