list_gbp_locations
Retrieve all Google Business Profile locations linked to a specified GBP account. Use this to manage and view your business listings.
Instructions
List Google Business Profile locations for a connected GBP account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| socialMediaId | Yes | GBP account ID (from list_accounts) |
Implementation Reference
- src/tools/accounts.ts:70-88 (handler)The tool handler for 'list_gbp_locations'. Calls client.get<GbpLocation[]> on /social-media/${socialMediaId}/gbp-locations to fetch GBP locations for a given social media account.
server.tool( 'list_gbp_locations', 'List Google Business Profile locations for a connected GBP account', { socialMediaId: z .string() .uuid() .describe('GBP account ID (from list_accounts)'), }, async (input) => { const data = await client.get<GbpLocation[]>( `/social-media/${input.socialMediaId}/gbp-locations`, ); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/tools/accounts.ts:11-88 (registration)The registerAccountTools function registers the 'list_gbp_locations' tool (along with other account tools) on the MCP server via server.tool(). The tool is registered with name 'list_gbp_locations' and a zod schema for socialMediaId.
export function registerAccountTools( server: McpServer, client: PostFastClient, ) { server.tool( 'list_accounts', 'List all social media accounts connected to the workspace', {}, async () => { const data = await client.get<SocialAccount[]>( '/social-media/my-social-accounts', ); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); server.tool( 'list_pinterest_boards', 'List Pinterest boards for a connected Pinterest account', { socialMediaId: z .string() .uuid() .describe('Pinterest account ID (from list_accounts)'), }, async (input) => { const data = await client.get<PinterestBoard[]>( `/social-media/${input.socialMediaId}/pinterest-boards`, ); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); server.tool( 'list_youtube_playlists', 'List YouTube playlists for a connected YouTube account', { socialMediaId: z .string() .uuid() .describe('YouTube account ID (from list_accounts)'), }, async (input) => { const data = await client.get<YouTubePlaylist[]>( `/social-media/${input.socialMediaId}/youtube-playlists`, ); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); server.tool( 'list_gbp_locations', 'List Google Business Profile locations for a connected GBP account', { socialMediaId: z .string() .uuid() .describe('GBP account ID (from list_accounts)'), }, async (input) => { const data = await client.get<GbpLocation[]>( `/social-media/${input.socialMediaId}/gbp-locations`, ); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/types.ts:78-84 (schema)The GbpLocation type definition used as the return type for list_gbp_locations. Fields: id, locationId, title, address, mapsUri.
export interface GbpLocation { id: string; locationId: string; title: string; address: string | null; mapsUri: string | null; } - src/tools/posts.ts:166-166 (helper)gbpLocationId parameter in the create_post tool references list_gbp_locations as the source for GBP location resource names.
gbpLocationId: z.string().optional().describe('GBP location resource name (from list_gbp_locations)'), - src/index.ts:7-7 (registration)Import of registerAccountTools which registers the list_gbp_locations tool.
import { registerAccountTools } from './tools/accounts.js';