Skip to content

feat: add message_type to MCPMessage trait #26

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
Feb 19, 2025

Conversation

hashemix
Copy link
Member

@hashemix hashemix commented Feb 18, 2025

📌 Summary

  • Added message_type() method to the MCPMessage Trait that returns a MessageTypes enum.
    Implemented for ClientMessage and ServerMessage enums
  • Moved the request_id() method of the MCPMessage trait into a super trait (RPCMessage) , so MCPMessage could be also implemented for types that does not necessarily have a requestId or jsonrpc version.

Example:

fn print_message_type( message: ClientMessage ){
    if message.is_request() {
        println!("This message is a Request!");
    }
}

@hashemix hashemix self-assigned this Feb 18, 2025
@hashemix hashemix merged commit aca2336 into main Feb 19, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant