Skip to main content
Glama

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
NameRequiredDescriptionDefault
file_pathYes
lineYes
columnYes

Implementation Reference

  • 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
            })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/qinsehm1128/mcp-ty'

If you have feedback or need assistance with the MCP directory API, please join our Discord server