Skip to main content
Glama

search_steam_games

Find Steam games by name or keywords to get AppID, pricing, and preview images for informed purchasing decisions.

Instructions

Search for Steam games by name or keywords. Supports single or batch queries. Returns basic game information including AppID, name, price, and preview image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSingle search query (game name or keywords)
queriesNoMultiple search queries for batch searching
limitNoMaximum number of results PER QUERY (default: 10, max: 25)

Implementation Reference

  • Main handler for search_steam_games tool (stdio mode). Validates input using Zod schema, supports both single and batch queries, calls steamClient.searchGames(), and returns JSON results.
    if (name === 'search_steam_games') { // Validate input using Zod schema const validatedInput = searchGamesSchema.parse(args); let results: SteamGame[]; if (validatedInput.queries) { // Batch search - execute all queries in parallel const allResults = await Promise.all( validatedInput.queries.map((q) => steamClient.searchGames(q, validatedInput.limit)) ); // Flatten results from all queries results = allResults.flat(); } else { // Single search results = await steamClient.searchGames(validatedInput.query!, validatedInput.limit); } return { content: [ { type: 'text', text: JSON.stringify(results, null, 2), }, ], };
  • Zod schema for validating search_steam_games input parameters. Supports optional 'query' (single search) or 'queries' (batch up to 5), and optional 'limit' (1-25 results per query). Validates that either query or queries is provided.
    * Zod schema for validating search_steam_games input. * Supports both single query and batch queries. */ const searchGamesSchema = z .object({ query: z.string().optional(), queries: z.array(z.string()).min(1).max(5).optional(), limit: z.number().min(1).max(25).optional(), }) .refine((data) => data.query || data.queries, { message: 'Either query or queries must be provided', });
  • src/index.ts:31-59 (registration)
    Tool registration in the MCP tools array. Defines the tool name 'search_steam_games', description, and input schema with properties for query/queries and limit.
    const tools: Tool[] = [ { name: 'search_steam_games', description: 'Search for Steam games by name or keywords. Supports single or batch queries. Returns basic game information including AppID, name, price, and preview image.', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Single search query (game name or keywords)', }, queries: { type: 'array', items: { type: 'string' }, description: 'Multiple search queries for batch searching', minItems: 1, maxItems: 5, }, limit: { type: 'number', description: 'Maximum number of results PER QUERY (default: 10, max: 25)', minimum: 1, maximum: 25, }, }, // Note: Either query OR queries must be provided (validated in Zod) }, },
  • SteamAPIClient.searchGames method that implements the actual Steam search functionality. Scrapes Steam store search results page using cheerio, parses HTML to extract game info (AppID, name, price, image, release date), implements caching, and returns array of SteamGame objects.
    * Search for games on the Steam store by name/keywords. * * This method scrapes the Steam search results page since Steam doesn't * provide a dedicated search API. Results are cached for 2 hours. * * @param query - Search query (game name or keywords) * @param limit - Maximum number of results to return (default: 10) * @returns Promise resolving to an array of SteamGame objects * * @example * ```typescript * const games = await client.searchGames('Dota', 5); * console.log(games[0].name); // "Dota 2" * ``` */ async searchGames(query: string, limit: number = 10): Promise<SteamGame[]> { const cacheKey = `search_${query}_${limit}`; // Check cache first if (this.config.cacheEnabled) { const cached = this.cache.get(cacheKey) as SteamGame[] | undefined; if (cached !== undefined) { return cached; } } // Build search URL const searchUrl = `https://store.steampowered.com/search/?term=${encodeURIComponent(query)}`; // Fetch HTML content using the get method for rate limiting and retry const html = await this.get<string>(searchUrl); // Parse HTML with cheerio const $ = cheerio.load(html); const results: SteamGame[] = []; // Select search result rows $('.search_result_row').each((index, element) => { if (results.length >= limit) { return false; // Stop iteration when limit reached } const $row = $(element); // Extract AppID from data attribute const appIdStr = $row.attr('data-ds-appid'); if (!appIdStr) { return; // Skip if no AppID } const appId = parseInt(appIdStr, 10); if (isNaN(appId)) { return; // Skip if AppID is not a valid number } // Extract game name const name = $row.find('.title').text().trim(); // Extract price const priceText = $row.find('.search_price').text().trim(); const priceFormatted = this.parsePriceText(priceText); // Extract image URL const headerImage = $row.find('.search_capsule img').attr('src') || undefined; // Extract release date (if available) const releaseDate = $row.find('.search_released').text().trim() || undefined; // Build SteamGame object const game: SteamGame = { appId, name, headerImage, releaseDate, priceFormatted, }; results.push(game); }); // Cache the results if (this.config.cacheEnabled) { this.cache.set(cacheKey, results, this.config.cacheTTL.gameInfo); } return results; } /** * Parse price text from Steam search results. * * @param priceText - Raw price text from search result * @returns Formatted price string or undefined */ private parsePriceText(priceText: string): string | undefined { // Clean up the price text const cleaned = priceText.replace(/\s+/g, ' ').trim(); // Handle free to play if (cleaned.toLowerCase().includes('free')) { return 'Free'; } // Handle discounted prices (take the final price) // Format is often "Original Price\nFinal Price" or just "Price" const lines = cleaned .split('\n') .map((l) => l.trim()) .filter(Boolean); if (lines.length > 0) { // Return the last non-empty line (final price after discount) return lines[lines.length - 1] || undefined; } return cleaned || undefined; }
  • TypeScript interface SearchGamesInput defining the input parameters structure for search_steam_games tool with query string and optional limit number.
    * Input parameters for search_steam_games tool */ export interface SearchGamesInput { query: string; limit?: number; // Default: 10 }

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/jhomen368/steam-reviews-mcp'

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