Skip to content

Commit 3f2b5a5

Browse files
authored
chore: update readme (#32)
* implement ToMessage trait * format * update readme
1 parent 435f18b commit 3f2b5a5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,10 @@ This code snippet demonstrates how to create an InitializeRequest, serialize it
211211
};
212212

213213

214-
// Create a ServerMessage (a message that will be sent from the server)
215-
let message = ServerMessage::Response(ServerJsonrpcResponse::new(
216-
RequestId::Integer(15),
217-
ResultFromServer::ServerResult(ServerResult::InitializeResult(initial_result)),
218-
));
214+
// Create a ServerMessage (a message intended to be sent from the server)
215+
let message: ServerMessage = initial_result.to_message(request_id).unwrap();
219216

220-
// serialize MCP Message into valid json string to be sent to the client
217+
// Serialize the MCP message into a valid JSON string for sending to the client
221218
let json_payload = message.to_string();
222219

223220
println!("{}", json_payload);

0 commit comments

Comments
 (0)