Skip to main content
Glama
devhub

DevHub CMS MCP

Official
by devhub

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
NameRequiredDescriptionDefault
business_idYes

Implementation Reference

  • 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']]

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/devhub/devhub-cms-mcp'

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