MCPcopy Create free account
hub / github.com/dexwritescode/rust-mcp / get_diagnostics

Method get_diagnostics

src/server/handler.rs:122–148  ·  view source on GitHub ↗
(
        &self,
        Parameters(GetDiagnosticsParams { file_path }): Parameters<GetDiagnosticsParams>,
    )

Source from the content-addressed store, hash-verified

120
121 #[tool(description = "Get compiler diagnostics for a file")]
122 async fn get_diagnostics(
123 &self,
124 Parameters(GetDiagnosticsParams { file_path }): Parameters<GetDiagnosticsParams>,
125 ) -> Result<CallToolResult, McpError> {
126 let args = serde_json::json!({
127 "file_path": file_path
128 });
129
130 let mut analyzer = self.analyzer.lock().await;
131 match execute_tool("get_diagnostics", args, &mut analyzer).await {
132 Ok(result) => {
133 if let Some(content) = result.content.first() {
134 if let Some(text) = content.get("text") {
135 return Ok(CallToolResult::success(vec![Content::text(
136 text.as_str().unwrap_or("No result"),
137 )]));
138 }
139 }
140 Ok(CallToolResult::success(vec![Content::text(
141 "No diagnostics found",
142 )]))
143 }
144 Err(e) => Ok(CallToolResult::success(vec![Content::text(format!(
145 "Error: {e}"
146 ))])),
147 }
148 }
149
150 #[tool(description = "Search for symbols in the workspace")]
151 async fn workspace_symbols(

Callers

nothing calls this directly

Calls 1

execute_toolFunction · 0.85

Tested by

no test coverage detected