Skip to main content
Glama

custom_query

Execute custom Apicalypse queries to retrieve specific video game data from IGDB endpoints like games, companies, or platforms.

Instructions

Run a custom Apicalypse query against any IGDB API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYesThe API endpoint to query (e.g., 'games', 'companies', 'platforms', 'people', 'characters')
queryYesThe Apicalypse query string

Implementation Reference

  • The @mcp.tool decorator registers the custom_query tool with its metadata (name, title, description).
    @mcp.tool( name="custom_query", title="Custom IGDB Query", description="Run a custom Apicalypse query against any IGDB API endpoint" )
  • The main handler function for the custom_query tool. It takes an endpoint and query string, gets the IGDB client, and makes the API request using the provided query.
    async def custom_query( endpoint: Annotated[ str, Field( description="The API endpoint to query (e.g., 'games', 'companies', 'platforms', 'people', 'characters')" ), ], query: Annotated[str, Field(description="The Apicalypse query string")], ctx: Context, ) -> List[Dict[str, Any]]: """ Execute a custom IGDB API query. This allows advanced users to write their own IGDB queries using the Apicalypse query language. See https://api-docs.igdb.com/#apicalypse for query syntax. Args: endpoint: The API endpoint to query (e.g., "games", "companies", "platforms") query: The Apicalypse query string ctx: Context for accessing session configuration Returns: Raw response from the IGDB API Example: endpoint: "games" query: "fields name,rating; where rating > 90; sort rating desc; limit 5;" """ igdb_client = get_igdb_client(ctx) return await igdb_client.make_request(endpoint, query)
  • The IGDBClient.make_request method called by the handler to perform the actual HTTP POST request to the IGDB API with authentication.
    async def make_request(self, endpoint: str, query: str) -> List[Dict[str, Any]]: """Make a request to the IGDB API.""" token = await self.get_access_token() response = await self.http_client.post( f"{IGDB_BASE_URL}/{endpoint}", headers={ "Client-ID": self.client_id, "Authorization": f"Bearer {token}", "Accept": "application/json", }, content=query, timeout=30.0, ) response.raise_for_status() data = response.json() if isinstance(data, list): return data return [data]

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/bielacki/igdb-mcp-server'

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