Skip to main content
Glama
hydavinci

Chromium Commits Query Tool

by hydavinci

get_chromium_latest_commit

Retrieve the most recent commit details for a specific file in the Chromium repository, including hash, author, message, and changes.

Instructions

MCP handler to get the latest commit information for a specified file in Chromium repository

Args:
    file_path (str): Relative path of the file in Chromium repository (e.g., "components/sync/service/data_type_manager.cc")

Returns:
    str: Formatted commit information including hash, author, message, modified files list, and diff details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Implementation Reference

  • The MCP tool handler function, registered via @mcp.tool decorator, which executes the tool logic by instantiating ChromiumCommitFetcher and calling its get_file_commit_info method with detailed and diff options.
    @mcp.tool("get_chromium_latest_commit")
    async def get_chromium_latest_commit(file_path: str):
        """
        MCP handler to get the latest commit information for a specified file in Chromium repository
    
        Args:
            file_path (str): Relative path of the file in Chromium repository (e.g., "components/sync/service/data_type_manager.cc")
    
        Returns:
            str: Formatted commit information including hash, author, message, modified files list, and diff details
        """
        fetcher = ChromiumCommitFetcher()
        return fetcher.get_file_commit_info(file_path, detailed=True, show_diff=True)
  • Core helper method in ChromiumCommitFetcher class that orchestrates fetching the latest commit info for a file, retrieves commit details and diff if requested, and formats the output. This is the primary implementation delegated to by the tool handler.
    def get_file_commit_info(
        self, file_path: str, detailed: bool = True, show_diff: bool = False
    ) -> Optional[str]:
        """
        Get complete commit information for a file
    
        Args:
            file_path: File path
            detailed: Whether to get detailed information (including all modified files)
            show_diff: Whether to show diff code comparison
    
        Returns:
            Formatted commit information string
        """
        # Get the latest commit for the file
        commit_info = self.get_file_latest_commit(file_path)
        if not commit_info:
            return None
    
        commit_details = None
        commit_diff = None
    
        commit_hash = commit_info.get("commit")
        if commit_hash:
            if detailed:
                commit_details = self.get_commit_details(commit_hash)
            if show_diff:
                commit_diff = self.get_commit_diff(commit_hash)
    
        return self.format_commit_info(
            commit_info, commit_details, show_diff, commit_diff
        )
  • Helper method that queries the Chromium Gitiles API to find the latest commit hash and basic info for the specific file path.
    def get_file_latest_commit(self, file_path: str) -> Optional[Dict]:
        """
        Get the latest commit information for the specified file
    
        Args:
            file_path: Relative path of the file, e.g. "components/sync/service/data_type_manager.cc"
    
        Returns:
            Dictionary containing commit information, or None if not found
        """
        # Normalize path format (use forward slashes)
        normalized_path = file_path.replace("\\", "/")
        # Build API URL to get commit history for this file
        url = f"{self.base_url}/+log/HEAD/{normalized_path}?format=JSON&n=1"
    
        try:
            print(f"Querying file: {normalized_path}")
            print(f"Request URL: {url}")
    
            response = requests.get(url, timeout=30)
            response.raise_for_status()
    
            # Gitiles API returns JSON with a security prefix ")]}'" that needs to be removed
            content = response.text
            if content.startswith(")]}'"):
                content = content[4:]
    
            data = json.loads(content)
    
            if "log" not in data or not data["log"]:
                print(f"Error: No commit history found for file {normalized_path}")
                return None
    
            # Get the latest commit
            latest_commit = data["log"][0]
            return latest_commit
    
        except requests.exceptions.RequestException as e:
            print(f"Network request error: {e}")
            return None
        except json.JSONDecodeError as e:
            print(f"JSON parsing error: {e}")
            return None
        except Exception as e:
            print(f"Unknown error: {e}")
            return None
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the return format but doesn't address important behavioral aspects like rate limits, authentication requirements, error conditions, or whether this queries a live repository versus cached data. The description provides basic output format but misses key operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured and concise. It begins with a clear purpose statement, then provides well-organized sections for Args and Returns with specific details. Every sentence adds value, and there's no redundant or unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no output schema, the description covers the basic purpose and parameter meaning adequately. However, it lacks important context about the tool's behavior, error handling, and operational constraints. The return format is described but not comprehensively enough given the absence of output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides excellent parameter semantics despite 0% schema description coverage. It clearly explains what 'file_path' represents ('Relative path of the file in Chromium repository'), provides a concrete example, and specifies the format expectation. This fully compensates for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('get the latest commit information') and target resource ('for a specified file in Chromium repository'). It distinguishes the tool's purpose with precision, mentioning both what it retrieves (commit information) and the specific context (Chromium repository).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when needing latest commit details for a Chromium file, but provides no explicit guidance on when to use this tool versus alternatives. With no sibling tools mentioned, there's no differentiation needed, but it lacks any context about prerequisites, limitations, or when-not-to-use scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/hydavinci/chromium-commits'

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