Skip to content

Commit 4e89be3

Browse files
committed
docs: fix doc test in README.md
1) fix doc test in readme 2) fix some fmt Signed-off-by: jokemanfire <[email protected]>
1 parent 38393a8 commit 4e89be3

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff 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

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ Start a client in one line:
2424
use rmcp::{ServiceExt, transport::TokioChildProcess};
2525
use 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

crates/rmcp/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![doc = include_str!("../../../README.md")]
21
mod error;
32
pub use error::Error;
43

examples/servers/src/common/counter.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)