Skip to main content
Glama

track_identifier

Register identifiers to ensure consistent usage across codebases. This tool tracks function, variable, class, method, and constant names for consistency checking.

Instructions

Explicitly track an identifier for consistency checking.

Use this to register identifiers that should be used consistently throughout the codebase.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Implementation Reference

  • The handler function `track_identifier` which is exposed as an MCP tool. It calls `session_tracker.track_identifier`.
    async def track_identifier(
        request: IdentifierTrackRequest, context: Context
    ) -> dict[str, Any]:
        """
        Explicitly track an identifier for consistency checking.
    
        Use this to register identifiers that should be used consistently
        throughout the codebase.
        """
        session_tracker.track_identifier(
            name=request.name,
            id_type=request.type,
            signature=request.signature,
            file_path=request.file_path,
        )
    
        return {
            "tracked": True,
            "identifier": request.name,
            "type": request.type,
            "timestamp": datetime.now().isoformat(),
        }
  • The input schema for the `track_identifier` tool.
    class IdentifierTrackRequest(BaseModel):
        """Request model for identifier tracking."""
    
        name: str = Field(..., description="Identifier name")
        type: str = Field(
            ..., description="Type: function, variable, class, method, constant"
        )
        signature: str | None = Field(None, description="Function/method signature")
        file_path: str | None = Field(None, description="File where identifier is defined")
  • The implementation of `SessionTracker.track_identifier` which actually stores the identifier information.
    def track_identifier(
        self,
        name: str,
        id_type: str,
        signature: str | None = None,
        file_path: str | None = None,
    ) -> None:
        """Track an identifier usage."""
        if name in self.identifiers:
            info = self.identifiers[name]
            info.occurrences += 1
            info.last_seen = datetime.now()
            if signature and signature not in info.signatures:
                info.signatures.append(signature)
            if file_path:
                info.file_locations.add(file_path)
        else:
            self.identifiers[name] = IdentifierInfo(
                name=name,
                type=id_type,
                first_seen=datetime.now(),
                last_seen=datetime.now(),
                signatures=[signature] if signature else [],
                file_locations={file_path} if file_path else set(),
            )
            self._update_similar_names(name)
    
    def _update_similar_names(self, name: str) -> None:
        """Update similar names mapping for consistency checking."""
        # Convert between naming conventions

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/kimasplund/mcp-pyrefly'

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