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)
        ]
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: it's a read operation (implied by 'Get'), warns about potential large result sets and overflow risks, specifies case-insensitive matching, and mentions error handling with 'Raises: HTTPException'. This covers most behavioral aspects needed for safe use.

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

Conciseness4/5

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

The description is well-structured with sections for Args, Returns, Raises, and Examples, making it easy to scan. It is appropriately sized, though the example section is slightly verbose with detailed output. Most sentences earn their place by adding value, such as the cautionary note and parameter explanation.

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

Completeness4/5

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

Given the tool's moderate complexity (1 parameter, no output schema, no annotations), the description is largely complete. It covers purpose, usage, parameters, returns, errors, and examples. However, it lacks explicit output schema details, though the Returns section partially compensates. For a tool with no annotations, it provides sufficient context for effective use.

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

Parameters5/5

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

The schema description coverage is 0%, so the description must fully compensate. It adds significant meaning beyond the basic schema by explaining that 'compiler_regex' is a 'Regular expression to match compiler names (case-insensitive)', provides examples of usage, and clarifies its purpose in narrowing results. This fully documents the single parameter's semantics.

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 tool's purpose with a specific verb ('Get') and resource ('available compiler versions'), and distinguishes it from siblings by focusing on version listing rather than compilation or language-specific listings. It explicitly mentions matching by 'compiler name regex', which adds specificity.

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

Usage Guidelines4/5

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

The description provides clear context on when to use this tool (to find compiler versions matching a regex) and includes a cautionary note about narrowing results to avoid overflow, which implies usage guidance. However, it does not explicitly compare to alternatives like 'list_compilers_for_language' or state when not to use it, missing full sibling differentiation.

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

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