Skip to content

Commit 78dcd2d

Browse files
committed
docs: update code examples for MCP 2025-11-25 API
- Update mcp-server lib.rs Quick Start with builder pattern - Use Implementation::with_description() instead of struct literals - Use ServerCapabilities::builder().enable_tools().build() - Use CallToolResult::empty() convenience method - Fix next_cursor: Option<String> in examples - Update MACRO_GUIDE.md version from 0.6 to 0.15
1 parent a77b0af commit 78dcd2d

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

docs/MACRO_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Add PulseEngine MCP Macros to your `Cargo.toml`:
1414

1515
```toml
1616
[dependencies]
17-
pulseengine-mcp-macros = "0.6"
17+
pulseengine-mcp-macros = "0.15"
1818
tokio = { version = "1.0", features = ["full"] }
1919
serde = { version = "1.0", features = ["derive"] }
2020
```

mcp-server/src/lib.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@
2424
//!
2525
//! fn get_server_info(&self) -> ServerInfo {
2626
//! ServerInfo {
27-
//! protocol_version: ProtocolVersion::default(),
28-
//! capabilities: ServerCapabilities::default(),
29-
//! server_info: Implementation {
30-
//! name: "My Server".to_string(),
31-
//! version: "1.0.0".to_string(),
32-
//! },
27+
//! protocol_version: ProtocolVersion::default(), // MCP 2025-11-25
28+
//! capabilities: ServerCapabilities::builder()
29+
//! .enable_tools()
30+
//! .build(),
31+
//! server_info: Implementation::with_description(
32+
//! "My Server",
33+
//! "1.0.0",
34+
//! "Example MCP server",
35+
//! ),
3336
//! instructions: Some("Example server".to_string()),
3437
//! }
3538
//! }
@@ -39,18 +42,18 @@
3942
//! }
4043
//!
4144
//! async fn call_tool(&self, _: CallToolRequestParam) -> Result<CallToolResult, Self::Error> {
42-
//! Ok(CallToolResult { content: vec![], is_error: Some(false) })
45+
//! Ok(CallToolResult::empty())
4346
//! }
4447
//!
4548
//! // Implement other required methods (simplified for example)
4649
//! # async fn list_resources(&self, _: PaginatedRequestParam) -> Result<ListResourcesResult, Self::Error> {
47-
//! # Ok(ListResourcesResult { resources: vec![], next_cursor: String::new() })
50+
//! # Ok(ListResourcesResult { resources: vec![], next_cursor: None })
4851
//! # }
4952
//! # async fn read_resource(&self, _: ReadResourceRequestParam) -> Result<ReadResourceResult, Self::Error> {
5053
//! # Err("No resources".into())
5154
//! # }
5255
//! # async fn list_prompts(&self, _: PaginatedRequestParam) -> Result<ListPromptsResult, Self::Error> {
53-
//! # Ok(ListPromptsResult { prompts: vec![], next_cursor: String::new() })
56+
//! # Ok(ListPromptsResult { prompts: vec![], next_cursor: None })
5457
//! # }
5558
//! # async fn get_prompt(&self, _: GetPromptRequestParam) -> Result<GetPromptResult, Self::Error> {
5659
//! # Err("No prompts".into())

0 commit comments

Comments
 (0)