list_identifiers
Display tracked Python identifiers in your session. Filter by type like functions or variables to organize code elements.
Instructions
List all tracked identifiers in the current session.
Optionally filter by type (function, variable, class, method, constant).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type_filter | No |
Implementation Reference
- src/mcp_pyrefly/server.py:344-365 (handler)The MCP tool handler function 'list_identifiers' that processes requests and returns identifier data.
@mcp.tool() async def list_identifiers( type_filter: str | None = None, context: Context | None = None ) -> dict[str, Any]: """ List all tracked identifiers in the current session. Optionally filter by type (function, variable, class, method, constant). """ identifiers = session_tracker.list_identifiers(id_type=type_filter) return { "count": len(identifiers), "identifiers": [ { "name": info.name, "type": info.type, "occurrences": info.occurrences, "first_seen": info.first_seen.isoformat(), "last_seen": info.last_seen.isoformat(), "signatures": info.signatures, "files": list(info.file_locations), - The underlying logic in 'SessionTracker' that retrieves and filters identifiers from the session data.
def list_identifiers(self, id_type: str | None = None) -> list[IdentifierInfo]: """List all tracked identifiers, optionally filtered by type.""" if id_type: return [info for info in self.identifiers.values() if info.type == id_type] return list(self.identifiers.values())