Get type info / docs at a Swift source position
swiftGetHoverInfoReturns SourceKit-LSP hover info and declaration fragment at a given position to help identify retain cycles and disambiguate self captures.
Instructions
[mg.code] SourceKit-LSP textDocument/hover at a (line, character) position. Returns the markdown / plaintext hover content plus a best-effort extracted declaration fragment. Use to disambiguate self captures: a class self in a closure can leak; a struct self can't.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filePath": "<filePath>",
"line": "<line>",
"character": "<character>"
},
"name": "swiftGetHoverInfo"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to a Swift source file. | |
| line | Yes | Zero-based line number (LSP convention). | |
| character | Yes | Zero-based UTF-16 character offset within the line. | |
| projectRoot | No |