get_locations
Retrieve detailed location data for a business, including address, coordinates, and URLs, using the business ID for DevHub CMS integration.
Instructions
Get all locations for a business
Returns a list of locations with the following fields:
- id: Location ID that can be used in the other tools
- location_name: Location name
- location_url: Location URL in DevHub
- street: Street address
- city: City
- state: State
- country: Country
- postal_code: Postal code
- lat: Latitude
- lon: Longitude
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| business_id | Yes |
Implementation Reference
- src/devhub_cms_mcp/server.py:71-106 (handler)The main handler function for the 'get_locations' MCP tool. It is decorated with @mcp.tool() which registers it as a tool with the name 'get_locations'. Fetches and formats locations for the given business_id from the DevHub API.@mcp.tool() def get_locations(business_id: int) -> list: """Get all locations for a business Returns a list of locations with the following fields: - id: Location ID that can be used in the other tools - location_name: Location name - location_url: Location URL in DevHub - street: Street address - city: City - state: State - country: Country - postal_code: Postal code - lat: Latitude - lon: Longitude """ client, base_url = get_client() params = { 'business_id': business_id, 'limit': 600, 'order_by': 'location_name', } r = client.get('{}locations/'.format(base_url), params=params) content = json.loads(r.content) return [{ 'id': location['id'], 'location_name': location['location_name'], 'location_url': location['location_url'], 'street': location['street'], 'city': location['city'], 'state': location['state'], 'country': location['country'], 'postal_code': location['postal_code'], 'lat': location['lat'], 'lon': location['lon'], } for location in content['objects']]