Skip to main content
Glama
torshepherd

Compiler Explorer MCP

by torshepherd

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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))
  • 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")

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