list_languages
Retrieve a list of programming languages supported by the Compiler Explorer API, including unique IDs, display names, and associated file extensions.
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-268 (handler)MCP tool handler for 'list_languages'. This is the primary execution function registered as a tool via @mcp.tool(). It 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 implementation of list_languages in CompilerExplorerClient class. Performs the HTTP GET request to Compiler Explorer API to retrieve the list of languages.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")
- server.py:252-252 (registration)Registration of the list_languages tool using the @mcp.tool() decorator on FastMCP instance.@mcp.tool()