get_type_info
Retrieve type information for Python symbols at specific file positions to enable precise code analysis and editing.
Instructions
Get type information for symbol at position (1-based).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| line | Yes | ||
| column | Yes |
Implementation Reference
- src/mcp_ty/server.py:409-430 (handler)The get_type_info tool is defined here as an MCP tool, providing type information for a symbol at a given position in a file using the LSP client.
@mcp.tool() async def get_type_info(file_path: str, line: int, column: int) -> str: """Get type information for symbol at position (1-based).""" client = _get_client() path = Path(file_path).resolve() if not path.exists(): return _error(f"File not found: {file_path}") try: await client.open_document(path) hover_info = await client.get_hover(path, line - 1, column - 1) if not hover_info: return _not_found(f"No type info at {path.name}:{line}:{column}") return _ok({ "file": path.name, "line": line, "column": column, "type_info": hover_info })