Skip to main content
Glama
torshepherd

Compiler Explorer MCP

by torshepherd

list_compiler_versions

Find available compiler versions by searching with a regular expression to match compiler names, returning detailed compiler information for development and analysis.

Instructions

Get available compiler versions matching a compiler name regex.

NOTE: This may return a lot of results! Choose a specific regex to narrow down the results and not overflow the MCP client.

Args:
    compiler_regex: Regular expression to match compiler names (case-insensitive)

Returns:
    List of dictionaries containing matching compiler information, each with keys:
    - id: Unique identifier for the compiler
    - name: Display name of the compiler
    - semver: Version string of the compiler

Raises:
    HTTPException: If the API request fails

Example:
    >>> await list_compiler_versions("gcc")
    [{"id": "gcc-12.2", "name": "GCC 12.2"}, {"id": "gcc-11.3", "name": "GCC 11.3"}]

    >>> await list_compiler_versions("clang.*trunk")
    [..., {"id": "irclangtrunk", "name": "clang (trunk)", "lang": "llvm", "compilerType": "", "semver": "(trunk)", "instructionSet": "amd64"}, ...]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
compiler_regexYes

Implementation Reference

  • The handler function decorated with @mcp.tool(), which implements the core logic of listing compiler versions matching the provided regex by querying ce_client and filtering results.
    @mcp.tool()
    async def list_compiler_versions(compiler_regex: str) -> list[dict[str, str]]:
        """Get available compiler versions matching a compiler name regex.
    
        NOTE: This may return a lot of results! Choose a specific regex to narrow down the results and not overflow the MCP client.
    
        Args:
            compiler_regex: Regular expression to match compiler names (case-insensitive)
    
        Returns:
            List of dictionaries containing matching compiler information, each with keys:
            - id: Unique identifier for the compiler
            - name: Display name of the compiler
            - semver: Version string of the compiler
    
        Raises:
            HTTPException: If the API request fails
    
        Example:
            >>> await list_compiler_versions("gcc")
            [{"id": "gcc-12.2", "name": "GCC 12.2"}, {"id": "gcc-11.3", "name": "GCC 11.3"}]
    
            >>> await list_compiler_versions("clang.*trunk")
            [..., {"id": "irclangtrunk", "name": "clang (trunk)", "lang": "llvm", "compilerType": "", "semver": "(trunk)", "instructionSet": "amd64"}, ...]
        """
        compilers = await ce_client.list_compilers()
        return [
            c
            for c in compilers
            if re.search(compiler_regex, c["name"], re.IGNORECASE)
            or re.search(compiler_regex, c["id"], re.IGNORECASE)
        ]

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/torshepherd/compiler-explorer-mcp'

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