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).
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": {
"file_path": "<file_path>",
"line": "<line>",
"column": "<column>"
},
"name": "get_type_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| line | Yes | ||
| column | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | 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 })