Skip to content

refactor!: naming & less constrained dependencies #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2025

Conversation

virtualritz
Copy link
Contributor

📌 Summary

  • Mostly resolves naming issues.

  • McpSdkError::AnyError (vs McpSdkError::AnyErrorStatic) had + 'static. I believe this was a copypasta oversight and removed it.

  • Cleaned up Cargo.tomls and reduced dependency versions to major. This way dependent crates can pick up latest, non-API breaking versions, according to semver.

🔍 Related Issues

✨ Changes Made

Made type & getter names adhere to official Rust API guidelines.

🛠️ Testing Steps

Ran cargo test/cargo test --all-features; all green.

Cargo.toml Outdated
@@ -1,34 +1,31 @@
[workspace]
resolver = "2"
resolver = "3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a few changes here that seem unrelated to the main issue—those might be better suited for a separate issue and PR. This way, we can review and merge each set of changes independently without mixing concerns.

I will point them out in this PR.

Switching to edition 2024 and resolver 3 are not among changes I would consider at this point until repo is more mature and more tests are added.

Cargo.toml Outdated
@@ -1,34 +1,31 @@
[workspace]
resolver = "2"
resolver = "3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resolver = "3"
resolver = "2"

Cargo.toml Outdated
[workspace.dependencies]
# Workspace member crates
rust-mcp-transport = { version = "0.1.1", path = "crates/rust-mcp-transport" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need the version there to be able to publish packages from workspace

Cargo.toml Outdated
[workspace.dependencies]
# Workspace member crates
rust-mcp-transport = { version = "0.1.1", path = "crates/rust-mcp-transport" }
rust-mcp-transport = { path = "crates/rust-mcp-transport" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rust-mcp-transport = { path = "crates/rust-mcp-transport" }
rust-mcp-transport = { version = "0.1.1", path = "crates/rust-mcp-transport" }

Cargo.toml Outdated
rust-mcp-sdk = { path = "crates/rust-mcp-sdk" }
rust-mcp-macros = { version = "0.1.2", path = "crates/rust-mcp-macros" }
rust-mcp-macros = { path = "crates/rust-mcp-macros" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rust-mcp-macros = { path = "crates/rust-mcp-macros" }
rust-mcp-macros = { version = "0.1.2", path = "crates/rust-mcp-macros" }

@@ -8,20 +8,20 @@ repository = "https://github.com/rust-mcp-stack/rust-mcp-sdk"
documentation = "https://docs.rs/rust-mcp-macros"
keywords = ["rust-mcp-stack", "model", "context", "protocol", "macros"]
license = "MIT"
edition = "2021"
edition = "2024"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the issue and not considering to switch to 2024 edition at this point.

Suggested change
edition = "2024"
edition = "2021"

@@ -8,19 +8,19 @@ repository = "https://github.com/rust-mcp-stack/rust-mcp-sdk"
documentation = "https://docs.rs/rust-mcp-sdk"
keywords = ["rust-mcp-stack", "model", "context", "protocol", "sdk"]
license = "MIT"
edition = "2021"
edition = "2024"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edition = "2024"
edition = "2021"

@@ -151,10 +151,10 @@ pub trait ServerHandler: Send + Sync + 'static {
///
/// Default implementation returns method not found error.
/// Customize this function in your specific handler to implement behavior tailored to your MCP server's capabilities and requirements.
async fn handle_get_prompt_request(
async fn handle_prompt_request(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For handlers, for consistency, I think it is better to keep the same naming convention that matches the request object name in the official schema. So for GetPromptRequest we would have handle_get_prompt_request()

Suggested change
async fn handle_prompt_request(
async fn handle_get_prompt_request(

@@ -8,17 +8,17 @@ repository = "https://github.com/rust-mcp-stack/rust-mcp-sdk"
documentation = "https://docs.rs/rust-mcp-transport"
keywords = ["rust-mcp-stack", "model", "context", "protocol", "sdk"]
license = "MIT"
edition = "2021"
edition = "2024"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edition = "2024"
edition = "2021"

Copy link
Member

@hashemix hashemix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements!

I added some minor change requests.

Also, I am not sure how feasible this is, but do you think we could avoid breaking changes by having some type aliases for types that are updated 🤔 and deprecate notes for them?

@virtualritz
Copy link
Contributor Author

I removed the commit with all the cargo-related stuff and re-renamed handle_get_prompt_request().

@hashemix
Copy link
Member

Hi @virtualritz , PR looks great! There’s a merge conflict with the main branch. Would you mind resolving it? Let me know if you need any help.

Most conflicts arise from my change in rust-mcp-schema, where I deprecated JsonrpcErrorError for a more user-friendly name, as we previously discussed.

@virtualritz
Copy link
Contributor Author

Done.

I don't think type aliases and deprecation warnings are needed at this stage as there are zero listed reverse dependencies on crates.io for now.

@hashemix hashemix changed the title Naming & less constrained dependencies refactor!: naming & less constrained dependencies Apr 15, 2025
@hashemix hashemix merged commit 2aa469b into rust-mcp-stack:main Apr 16, 2025
3 of 4 checks passed
This was referenced Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants