get_locations
Retrieve all business locations with addresses, coordinates, and URLs for use in DevHub CMS content management.
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 primary handler for the 'get_locations' MCP tool. It is registered via the @mcp.tool() decorator in FastMCP. The function retrieves locations for a given business_id from the DevHub API, formats them into a list of dicts with specified fields, and returns it. The docstring provides the input/output schema details.@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']]