list_languages
Retrieve available programming languages from Compiler Explorer to identify supported options for code compilation and analysis.
Instructions
Get a list of supported programming languages.
Returns:
List of dictionaries containing language information, each with keys:
- id: Unique identifier for the language
- name: Display name of the language
- extensions: List of file extensions associated with the language
Raises:
HTTPException: If the API request fails
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:252-269 (handler)MCP tool handler for 'list_languages' that delegates to the CompilerExplorerClient instance.@mcp.tool() async def list_languages() -> list[dict[str, str]]: """Get a list of supported programming languages. Returns: List of dictionaries containing language information, each with keys: - id: Unique identifier for the language - name: Display name of the language - extensions: List of file extensions associated with the language Raises: HTTPException: If the API request fails """ try: return await ce_client.list_languages() except CompilerExplorerError as e: raise HTTPException(status_code=e.status_code, detail=str(e))
- server.py:110-122 (helper)Core helper function in CompilerExplorerClient that fetches the list of languages from the Compiler Explorer API.async def list_languages(self) -> list[dict[str, str]]: """Get list of supported programming languages. Returns: List of dictionaries containing language information, each with keys: - id: Unique identifier for the language - name: Display name of the language - extensions: List of file extensions associated with the language Raises: CompilerExplorerError: If the API request fails """ return await self._make_request("GET", f"{self.base_url}/languages")