use crate::{
connect::lsp::{
LspClient,
request::HoverRequest,
},
connect::mcp::{
schema,
tool::{
Tool,
ToolError,
ToolRegistry,
},
},
protocol::lsp::{
Hover as LspHover,
HoverParams,
},
};
pub fn register(registry: &mut ToolRegistry) {
registry.register::<Hover>();
}
pub enum Hover {}
impl Tool for Hover {
type Input = HoverParams;
type Output = Option<LspHover>;
const NAME: &'static str = "hover";
const DESCRIPTION: &'static str =
"Get human-readable documentation for the symbol at the given position \
(type signature, docstring, etc.). Wraps LSP `textDocument/hover`.";
fn input_schema() -> serde_json::Value {
schema::text_document_position()
}
async fn call(
client: &LspClient,
input: Self::Input,
) -> Result<Self::Output, ToolError> {
Ok(client.send_request::<HoverRequest>(input).await?)
}
}