Skip to main content
Glama
satheeshds

Google Business Profile Review MCP Server

by satheeshds
locations.ts2.95 kB
/** * Business Locations Resource * Provides access to all business locations for the authenticated account */ import { logger } from '../../utils/logger.js'; import type { IReviewService, GetResourceResult } from '../../types/index.js'; export interface LocationsResource { uri: string; name: string; description: string; mimeType: string; handler: () => Promise<GetResourceResult>; } export function createLocationsResource(reviewService: IReviewService): LocationsResource { return { uri: 'locations://list', name: 'Business Locations', description: 'List of all business locations associated with the authenticated Google Business Profile account', mimeType: 'application/json', handler: async (): Promise<GetResourceResult> => { try { logger.info('Fetching locations resource'); const result = await reviewService.listLocations(); if (!result.success) { return { contents: [ { uri: 'locations://list', mimeType: 'text/plain', text: `Error: ${result.error}` } ] }; } const { locations } = result.data!; // Format locations for easy consumption const formattedData = { totalCount: locations.length, locations: locations.map(loc => ({ name: loc.name, displayName: loc.locationName, address: loc.address, phone: loc.primaryPhone, website: loc.websiteUri })) }; logger.info(`Successfully retrieved ${locations.length} location(s)`); return { contents: [ { uri: 'locations://list', mimeType: 'application/json', text: JSON.stringify(formattedData, null, 2) } ] }; } catch (error) { logger.error('Error fetching locations resource:', error); return { contents: [ { uri: 'locations://list', mimeType: 'text/plain', text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}` } ] }; } } }; }

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/satheeshds/gbp-review-agent'

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