Skip to main content
Glama
domdomegg

Google Maps Places MCP

places-photo-get.ts1.29 kB
import {z} from 'zod'; import type {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js'; import type {Config} from './types.js'; import {getPlacesPhotoUrl} from '../utils/places-api.js'; import {jsonResult} from '../utils/response.js'; const inputSchema = { photoName: z.string().describe('The photo resource name from a text search response (format: places/PLACE_ID/photos/PHOTO_RESOURCE)'), maxHeightPx: z.number().min(1).max(4800).optional().describe('Maximum height in pixels (1-4800)'), maxWidthPx: z.number().min(1).max(4800).optional().describe('Maximum width in pixels (1-4800)'), }; const outputSchema = z.object({ photoUri: z.string().describe('URL to the photo image'), }); export function registerPlacesPhotoGet(server: McpServer, config: Config): void { server.registerTool( 'places_photo_get', { title: 'Get Place Photo', description: 'Get a photo URL for a place. Use the photo name from a text search response. At least one of maxHeightPx or maxWidthPx should be specified.', inputSchema, outputSchema, annotations: { readOnlyHint: true, }, }, async ({photoName, maxHeightPx, maxWidthPx}) => { const photoUri = await getPlacesPhotoUrl(photoName, config.token, maxHeightPx, maxWidthPx); return jsonResult({photoUri}); }, ); }

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/domdomegg/google-maps-places-mcp'

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