get_steam_review
Retrieve formatted Steam game reviews, including scores, positive/negative counts, and texts, filtered by language, date, and review type. Supports analysis of game performance based on user feedback.
Instructions
Retrieves reviews and game information for a specific Steam application. Returns formatted review data including review scores, positive/negative counts, review texts, and basic game information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appid | Yes | Steam application ID | |
| cursor | No | reviews are returned in batches of 20, so pass * for the first set, then the value of cursor that was returned in the response for the next set, etc. Note that cursor values may contain characters that need to be URLEncoded for use in the querystring. | * |
| day_range | No | range from now to n days ago to look for helpful reviews. Only applicable for the all filter. | |
| filter | No | recent: sorted by creation time, updated: sorted by last updated time,all: (default) sorted by helpfulness, with sliding windows based on day_range parameter, will always find results to return. | all |
| language | No | Language filter (e.g. english, french, schinese). Default is all languages. | all |
| num_per_page | No | number of reviews to get, max 100, default 50 | |
| purchase_type | No | all: all reviews, non_steam_purchase: reviews written by users who did not pay for the product on Steam,steam: reviews written by users who paid for the product on Steam (default) | steam |
| review_type | No | all:all reviews (default), positive: only positive reviews, negative: only negative reviews | all |
Implementation Reference
- src/index.ts:69-137 (handler)The main handler function for the 'get_steam_review' tool. It fetches Steam reviews and game information using the Steam Store API, processes the data (including cleaning review texts), formats it as JSON, and returns it as a text content block.async (params) => { try { // Fetch game reviews const reviewsUrl = new URL(`appreviews/${params.appid}`, STEAM_API_BASE); reviewsUrl.searchParams.append("json", "1"); reviewsUrl.searchParams.append("filter", params.filter); reviewsUrl.searchParams.append("language", params.language); reviewsUrl.searchParams.append("day_range", params.day_range.toString()); reviewsUrl.searchParams.append("cursor", params.cursor); reviewsUrl.searchParams.append("review_type", params.review_type); reviewsUrl.searchParams.append("purchase_type", params.purchase_type); reviewsUrl.searchParams.append("num_per_page", params.num_per_page.toString()); const reviewsResponse = await fetch(reviewsUrl, { headers: { "User-Agent": USER_AGENT } }); if (!reviewsResponse.ok) { throw new Error(`Failed to fetch reviews: ${reviewsResponse.statusText}`); } const reviewsData = await reviewsResponse.json(); // Extract required review information and review texts const game_reviews = { success: reviewsData.success, review_score: reviewsData.query_summary?.review_score, review_score_desc: reviewsData.query_summary?.review_score_desc, total_positive: reviewsData.query_summary?.total_positive, total_negative: reviewsData.query_summary?.total_negative, reviews: reviewsData.reviews ? reviewsData.reviews.map((review: any) => cleanReviewText(review.review)) : [] }; // Fetch game info const infoUrl = new URL("api/appdetails", STEAM_API_BASE); infoUrl.searchParams.append("appids", params.appid); const infoResponse = await fetch(infoUrl, { headers: { "User-Agent": USER_AGENT } }); if (!infoResponse.ok) { throw new Error(`Failed to fetch game info: ${infoResponse.statusText}`); } const infoData = await infoResponse.json(); // Extract required game information const game_info = { name: infoData[params.appid]?.data?.name, detailed_description: infoData[params.appid]?.data?.detailed_description }; // To be compatible with models such as DeepSeek R1 and DeepSeek V3, convert the format const formattedJsonData = JSON.stringify({ game_reviews, game_info }, null, 2); return { content: [ { type: "text", text: formattedJsonData } ] }; } catch (error) { console.error(error); throw error; } }
- src/index.ts:47-62 (schema)Zod schema defining the input parameters for the 'get_steam_review' tool, including appid, filter options, language, etc., with descriptions and defaults.const SteamReviewParamsSchema = { appid: z.string().describe("Steam application ID"), filter: z.string().default("all").describe("recent: sorted by creation time, updated: sorted by last updated time,all: (default) sorted by helpfulness, with sliding windows based on day_range parameter, will always find results to return."), language: z.enum([ "all", "arabic", "bulgarian", "schinese", "tchinese", "czech", "danish", "dutch", "english", "finnish", "french", "german", "greek", "hungarian", "indonesian", "italian", "japanese", "koreana", "norwegian", "polish", "portuguese", "brazilian", "romanian", "russian", "spanish", "latam", "swedish", "thai", "turkish", "ukrainian", "vietnamese" ]).default("all").describe("Language filter (e.g. english, french, schinese). Default is all languages."), day_range: z.number().default(365).describe("range from now to n days ago to look for helpful reviews. Only applicable for the all filter."), cursor: z.string().default("*").describe("reviews are returned in batches of 20, so pass * for the first set, then the value of cursor that was returned in the response for the next set, etc. Note that cursor values may contain characters that need to be URLEncoded for use in the querystring."), review_type: z.string().default("all").describe("all:all reviews (default), positive: only positive reviews, negative: only negative reviews"), purchase_type: z.string().default("steam").describe("all: all reviews, non_steam_purchase: reviews written by users who did not pay for the product on Steam,steam: reviews written by users who paid for the product on Steam (default)"), num_per_page: z.number().default(50).describe("number of reviews to get, max 100, default 50"), };
- src/index.ts:64-138 (registration)Registration of the 'get_steam_review' tool using server.tool(), including name, description, schema, and handler function.// Add the tool to get steam reviews server.tool( "get_steam_review", "Retrieves reviews and game information for a specific Steam application. Returns formatted review data including review scores, positive/negative counts, review texts, and basic game information.", SteamReviewParamsSchema, async (params) => { try { // Fetch game reviews const reviewsUrl = new URL(`appreviews/${params.appid}`, STEAM_API_BASE); reviewsUrl.searchParams.append("json", "1"); reviewsUrl.searchParams.append("filter", params.filter); reviewsUrl.searchParams.append("language", params.language); reviewsUrl.searchParams.append("day_range", params.day_range.toString()); reviewsUrl.searchParams.append("cursor", params.cursor); reviewsUrl.searchParams.append("review_type", params.review_type); reviewsUrl.searchParams.append("purchase_type", params.purchase_type); reviewsUrl.searchParams.append("num_per_page", params.num_per_page.toString()); const reviewsResponse = await fetch(reviewsUrl, { headers: { "User-Agent": USER_AGENT } }); if (!reviewsResponse.ok) { throw new Error(`Failed to fetch reviews: ${reviewsResponse.statusText}`); } const reviewsData = await reviewsResponse.json(); // Extract required review information and review texts const game_reviews = { success: reviewsData.success, review_score: reviewsData.query_summary?.review_score, review_score_desc: reviewsData.query_summary?.review_score_desc, total_positive: reviewsData.query_summary?.total_positive, total_negative: reviewsData.query_summary?.total_negative, reviews: reviewsData.reviews ? reviewsData.reviews.map((review: any) => cleanReviewText(review.review)) : [] }; // Fetch game info const infoUrl = new URL("api/appdetails", STEAM_API_BASE); infoUrl.searchParams.append("appids", params.appid); const infoResponse = await fetch(infoUrl, { headers: { "User-Agent": USER_AGENT } }); if (!infoResponse.ok) { throw new Error(`Failed to fetch game info: ${infoResponse.statusText}`); } const infoData = await infoResponse.json(); // Extract required game information const game_info = { name: infoData[params.appid]?.data?.name, detailed_description: infoData[params.appid]?.data?.detailed_description }; // To be compatible with models such as DeepSeek R1 and DeepSeek V3, convert the format const formattedJsonData = JSON.stringify({ game_reviews, game_info }, null, 2); return { content: [ { type: "text", text: formattedJsonData } ] }; } catch (error) { console.error(error); throw error; } } );
- src/index.ts:11-38 (helper)Helper function used in the handler to clean and format review text by removing HTML, decoding entities, handling newlines, and normalizing spaces for safe JSON output.function cleanReviewText(text: string): string { if (!text) return ""; // Remove HTML tags let cleanText = text.replace(/<\/?[^>]+(>|$)/g, ""); // Decode common HTML entities cleanText = cleanText.replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, "") .replace(/'/g, "") .replace(/ /g, " "); // Handle newlines and other control characters cleanText = cleanText.replace(/\r\n/g, "\\n") .replace(/\n/g, "\\n") .replace(/\r/g, "\\n"); // Remove quotes cleanText = cleanText.replace(/["']/g, ""); // Replace multiple spaces with a single space cleanText = cleanText.replace(/\s+/g, " "); // Trim extra spaces return cleanText.trim(); }