Skip to content

Commit 6867d5c

Browse files
committed
refactor: separate elicitation methods into dedicated impl block for RoleServer
- Move (supports_elicitation, elicit_structured_input, elicit) to separate impl block - Move ElicitationError definition to elicitation methods section - Keep base methods (create_message, list_roots, notify_*) in main impl block with macro - Add section comments to distinguish general and elicitation-specific methods
1 parent c080d40 commit 6867d5c

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

crates/rmcp/src/service/server.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,25 @@ macro_rules! method {
327327
};
328328
}
329329

330+
impl Peer<RoleServer> {
331+
method!(peer_req create_message CreateMessageRequest(CreateMessageRequestParam) => CreateMessageResult);
332+
method!(peer_req list_roots ListRootsRequest() => ListRootsResult);
333+
method!(peer_req create_elicitation CreateElicitationRequest(CreateElicitationRequestParam) => CreateElicitationResult);
334+
335+
method!(peer_not notify_cancelled CancelledNotification(CancelledNotificationParam));
336+
method!(peer_not notify_progress ProgressNotification(ProgressNotificationParam));
337+
method!(peer_not notify_logging_message LoggingMessageNotification(LoggingMessageNotificationParam));
338+
method!(peer_not notify_resource_updated ResourceUpdatedNotification(ResourceUpdatedNotificationParam));
339+
method!(peer_not notify_resource_list_changed ResourceListChangedNotification);
340+
method!(peer_not notify_tool_list_changed ToolListChangedNotification);
341+
method!(peer_not notify_prompt_list_changed PromptListChangedNotification);
342+
}
343+
344+
// =============================================================================
345+
// ELICITATION CONVENIENCE METHODS
346+
// These methods are specific to server role and provide typed elicitation functionality
347+
// =============================================================================
348+
330349
/// Errors that can occur during typed elicitation operations
331350
#[derive(Error, Debug)]
332351
pub enum ElicitationError {
@@ -355,22 +374,6 @@ pub enum ElicitationError {
355374
}
356375

357376
impl Peer<RoleServer> {
358-
method!(peer_req create_message CreateMessageRequest(CreateMessageRequestParam) => CreateMessageResult);
359-
method!(peer_req list_roots ListRootsRequest() => ListRootsResult);
360-
method!(peer_req create_elicitation CreateElicitationRequest(CreateElicitationRequestParam) => CreateElicitationResult);
361-
362-
method!(peer_not notify_cancelled CancelledNotification(CancelledNotificationParam));
363-
method!(peer_not notify_progress ProgressNotification(ProgressNotificationParam));
364-
method!(peer_not notify_logging_message LoggingMessageNotification(LoggingMessageNotificationParam));
365-
method!(peer_not notify_resource_updated ResourceUpdatedNotification(ResourceUpdatedNotificationParam));
366-
method!(peer_not notify_resource_list_changed ResourceListChangedNotification);
367-
method!(peer_not notify_tool_list_changed ToolListChangedNotification);
368-
method!(peer_not notify_prompt_list_changed PromptListChangedNotification);
369-
370-
// =============================================================================
371-
// ELICITATION CONVENIENCE METHODS
372-
// =============================================================================
373-
374377
/// Check if the client supports elicitation capability
375378
///
376379
/// Returns true if the client declared elicitation capability during initialization,

0 commit comments

Comments
 (0)