google_reviews
Get Google reviews for a business by name and location, including review text, rating, date, author, and owner replies with sort options.
Instructions
Get Google reviews for a business. Returns review text, rating, date, author, and owner replies. Costs 1 credit per 10 reviews. Note: this tool may take 10-30 seconds to return — this is normal, not an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| business_name | Yes | Business name | |
| location | Yes | City and state | |
| limit | No | Number of reviews (1-100). Default: 10 | |
| sort | No | Sort order. Default: newest |
Implementation Reference
- src/tools/reviews.ts:22-29 (handler)Handler function for google_reviews tool. Calls the /v1/reviews/google API endpoint with business_name, location, optional limit and sort parameters, then formats the result.
withErrorHandling(async ({ business_name, location, limit, sort }) => { const result = await callApi( "/v1/reviews/google", { business_name, location, ...(limit && { limit }), ...(sort && { sort }) }, getAuth() ); return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] }; }) - src/tools/reviews.ts:15-20 (schema)Input schema for google_reviews tool, defined with Zod. Requires business_name and location strings; optional limit (1-100 integer) and sort (newest/highest/lowest/most_relevant).
{ business_name: z.string().describe("Business name"), location: z.string().describe("City and state"), limit: z.number().int().min(1).max(100).optional().describe("Number of reviews (1-100). Default: 10"), sort: z.enum(["newest", "highest", "lowest", "most_relevant"]).optional().describe("Sort order. Default: newest"), }, - src/tools/reviews.ts:12-30 (registration)Registration of google_reviews tool via server.tool() call in registerReviewTools function, with name, description, schema, READ_ONLY hint, and handler.
server.tool( "google_reviews", "Get Google reviews for a business. Returns review text, rating, date, author, and owner replies. Costs 1 credit per 10 reviews. Note: this tool may take 10-30 seconds to return — this is normal, not an error.", { business_name: z.string().describe("Business name"), location: z.string().describe("City and state"), limit: z.number().int().min(1).max(100).optional().describe("Number of reviews (1-100). Default: 10"), sort: z.enum(["newest", "highest", "lowest", "most_relevant"]).optional().describe("Sort order. Default: newest"), }, READ_ONLY, withErrorHandling(async ({ business_name, location, limit, sort }) => { const result = await callApi( "/v1/reviews/google", { business_name, location, ...(limit && { limit }), ...(sort && { sort }) }, getAuth() ); return { content: [{ type: "text" as const, text: formatResult(result.data, result) }] }; }) ); - src/server.ts:37-37 (registration)Top-level registration: registerReviewTools is called in createMcpServer to wire up all review tools including google_reviews.
registerReviewTools(server, getAuth); - src/api-client.ts:143-158 (helper)Helper that wraps the handler to catch errors and return them as MCP error content.
export function withErrorHandling<T>( fn: (args: T) => Promise<ToolResult> ): (args: T) => Promise<ToolResult> { return async (args) => { try { return await fn(args); } catch (err) { const message = err instanceof Error ? err.message : String(err); console.error(`[mcp] Tool error: ${message}`); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } }; }