list_compiler_versions
Retrieve compiler versions by specifying a regex pattern to match compiler names. Returns a list of compilers with IDs, names, and version strings for easy identification and selection.
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
| Name | Required | Description | Default |
|---|---|---|---|
| compiler_regex | Yes |
Implementation Reference
- server.py:309-342 (handler)The handler function for the 'list_compiler_versions' MCP tool. It is decorated with @mcp.tool() for registration. Fetches all compilers from Compiler Explorer API and filters those matching the provided regex on name or ID (case-insensitive). Includes input/output schema in type hints and docstring.@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) ]