search_games
Find video games in the IGDB database by entering search terms, retrieving details like ratings, release dates, and platforms.
Instructions
Search for games in the IGDB database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search term for finding games | |
| fields | No | Comma-separated list of fields to return | name,rating,rating_count,first_release_date,platforms.name |
| limit | No | Maximum number of results to return |
Implementation Reference
- src/igdb_mcp_server/server.py:154-158 (registration)Registration of the 'search_games' tool using the @mcp.tool decorator, specifying name, title, and description.@mcp.tool( name="search_games", title="Search Games", description="Search for games in the IGDB database" )
- src/igdb_mcp_server/server.py:159-185 (handler)The handler function implementing the logic for 'search_games': constructs an Apicalypse search query for the IGDB games endpoint and executes it via the IGDB client.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)
- Input schema definitions for the search_games tool parameters using Pydantic Field annotations, including descriptions, defaults, and constraints.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]]: