Skip to main content
Glama

search_games

Find video games in the IGDB database by entering search terms to retrieve titles, ratings, release dates, and platforms.

Instructions

Search for games in the IGDB database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term for finding games
fieldsNoComma-separated list of fields to returnname,rating,rating_count,first_release_date,platforms.name
limitNoMaximum number of results to return

Implementation Reference

  • The handler function that executes the search_games tool logic, querying the IGDB API with the provided search term and fields.
    async def search_games( query: Annotated[str, Field(description="Search term for finding games")], ctx: Context, fields: Annotated[ str, Field(description="Comma-separated list of fields to return") ] = "name,rating,rating_count,first_release_date,platforms.name", limit: Annotated[ int, Field(description="Maximum number of results to return", ge=1, le=500) ] = 10, ) -> List[Dict[str, Any]]: """ Search for games in the IGDB database. Args: query: Search term for finding games ctx: Context for accessing session configuration fields: Comma-separated list of fields to return limit: Maximum number of results to return (default: 10, max: 500) Returns: List of games matching the search criteria """ igdb_client = get_igdb_client(ctx) search_query = f'search "{query}"; fields {fields}; limit {limit};' return await igdb_client.make_request("games", search_query)
  • Registration of the search_games tool using the @mcp.tool decorator, including name, title, and description.
    @mcp.tool( name="search_games", title="Search Games", description="Search for games in the IGDB database" )
  • Input schema definitions using Pydantic Annotated and Field for the tool parameters.
    query: Annotated[str, Field(description="Search term for finding games")], ctx: Context, fields: Annotated[ str, Field(description="Comma-separated list of fields to return") ] = "name,rating,rating_count,first_release_date,platforms.name", limit: Annotated[ int, Field(description="Maximum number of results to return", ge=1, le=500) ] = 10, ) -> List[Dict[str, Any]]:
  • Helper function to get or create the IGDBClient instance, used by the search_games handler.
    def get_igdb_client(ctx: Optional[Context] = None) -> IGDBClient: """Get or create the IGDB client singleton.""" global _igdb_client if "_igdb_client" not in globals(): # Get credentials from environment variables or Smithery settings # Check if context has session_config (Smithery mode) settings = getattr(ctx, 'session_config', None) if ctx else None client_id = os.getenv("IGDB_CLIENT_ID") or (settings.IGDB_CLIENT_ID if settings else None) client_secret = os.getenv("IGDB_CLIENT_SECRET") or (settings.IGDB_CLIENT_SECRET if settings else None) if not client_id or not client_secret: raise ValueError( "Please set IGDB_CLIENT_ID and IGDB_CLIENT_SECRET. " "You can either set them as environment variables or configure them in Smithery. " "You can obtain these from https://api-docs.igdb.com/#account-creation" ) _igdb_client = IGDBClient(client_id, client_secret) return _igdb_client

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