11//! Shared types for Dialectic MCP Server
2- //!
2+ //!
33//! Mirrors the TypeScript types from server/src/types.ts to ensure
44//! protocol compatibility across the IPC boundary.
55
6- use serde:: { Deserialize , Serialize } ;
76use schemars:: JsonSchema ;
7+ use serde:: { Deserialize , Serialize } ;
88
99/// Parameters for the present-review MCP tool
10- ///
10+ ///
1111/// Matches PresentReviewParams from TypeScript implementation
1212#[ derive( Debug , Clone , Deserialize , Serialize , JsonSchema ) ]
1313pub struct PresentReviewParams {
1414 /// Markdown content of the review to display
1515 pub content : String ,
16-
16+
1717 /// How to handle the review content in the extension
1818 pub mode : ReviewMode ,
19-
19+
2020 /// Optional section name for update-section mode
2121 pub section : Option < String > ,
22-
22+
2323 /// Base directory path for resolving relative file references
2424 #[ serde( rename = "baseUri" ) ]
2525 pub base_uri : String ,
@@ -45,7 +45,7 @@ impl Default for ReviewMode {
4545pub struct PresentReviewResult {
4646 /// Whether the review was successfully presented
4747 pub success : bool ,
48-
48+
4949 /// Optional message about the operation
5050 pub message : Option < String > ,
5151}
@@ -55,7 +55,7 @@ pub struct PresentReviewResult {
5555pub struct LogParams {
5656 /// Log level
5757 pub level : LogLevel ,
58-
58+
5959 /// Log message content
6060 pub message : String ,
6161}
@@ -75,39 +75,39 @@ pub struct GetSelectionResult {
7575 /// Currently selected text, null if no selection
7676 #[ serde( rename = "selectedText" ) ]
7777 pub selected_text : Option < String > ,
78-
78+
7979 /// File path of the active editor, if available
8080 #[ serde( rename = "filePath" ) ]
8181 pub file_path : Option < String > ,
82-
82+
8383 /// Starting line number (1-based)
8484 #[ serde( rename = "startLine" ) ]
8585 pub start_line : Option < u32 > ,
86-
86+
8787 /// Starting column number (1-based)
8888 #[ serde( rename = "startColumn" ) ]
8989 pub start_column : Option < u32 > ,
90-
90+
9191 /// Ending line number (1-based)
9292 #[ serde( rename = "endLine" ) ]
9393 pub end_line : Option < u32 > ,
94-
94+
9595 /// Ending column number (1-based)
9696 #[ serde( rename = "endColumn" ) ]
9797 pub end_column : Option < u32 > ,
98-
98+
9999 /// Single line number if selection is on one line
100100 #[ serde( rename = "lineNumber" ) ]
101101 pub line_number : Option < u32 > ,
102-
102+
103103 /// Language ID of the document
104104 #[ serde( rename = "documentLanguage" ) ]
105105 pub document_language : Option < String > ,
106-
106+
107107 /// Whether the document is untitled
108108 #[ serde( rename = "isUntitled" ) ]
109109 pub is_untitled : Option < bool > ,
110-
110+
111111 /// Message explaining the selection state
112112 pub message : Option < String > ,
113113}
@@ -131,10 +131,10 @@ pub struct GoodbyePayload {
131131pub struct ResponsePayload {
132132 /// Whether the operation succeeded
133133 pub success : bool ,
134-
134+
135135 /// Optional error message
136136 pub error : Option < String > ,
137-
137+
138138 /// Optional data payload for responses like get_selection
139139 pub data : Option < serde_json:: Value > ,
140140}
@@ -145,10 +145,10 @@ pub struct IPCMessage {
145145 /// Message type identifier
146146 #[ serde( rename = "type" ) ]
147147 pub message_type : IPCMessageType ,
148-
148+
149149 /// Message payload
150150 pub payload : serde_json:: Value ,
151-
151+
152152 /// Unique message ID for response tracking
153153 pub id : String ,
154154}
@@ -169,5 +169,3 @@ pub enum IPCMessageType {
169169 /// Response to any message (replaces IPCResponse struct)
170170 Response ,
171171}
172-
173-
0 commit comments