Skip to main content
Glama

get_businesses

Retrieve all businesses from your DevHub account to obtain business IDs and names for use with other CMS tools.

Instructions

Get all businesses within the DevHub account

Returns a list of businesses with the following fields: - id: Business ID that can be used in the other tools - business_name: Business name If only one business exists in the account, you can assume that the user wants to use that business for any business_id related tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_businesses' tool, decorated with @mcp.tool() for registration. It fetches a list of businesses from the DevHub API using OAuth1Session, with parameters to filter non-deleted businesses ordered by name.
    @mcp.tool() def get_businesses() -> list: """Get all businesses within the DevHub account Returns a list of businesses with the following fields: - id: Business ID that can be used in the other tools - business_name: Business name If only one business exists in the account, you can assume that the user wants to use that business for any business_id related tools. """ client, base_url = get_client() params = { 'deleted': 0, 'limit': 20, 'order_by': 'business_name', 'project_type': 'default', } r = client.get('{}businesses/'.format(base_url), params=params) content = json.loads(r.content) return content['objects']
  • The @mcp.tool() decorator registers the get_businesses function as an MCP tool.
    @mcp.tool()
  • Function signature and docstring defining no input parameters and list output for businesses.
    def get_businesses() -> list: """Get all businesses within the DevHub account Returns a list of businesses with the following fields: - id: Business ID that can be used in the other tools - business_name: Business name If only one business exists in the account, you can assume that the user wants to use that business for any business_id related tools. """
  • Helper function to create the OAuth1 client and base URL used by get_businesses.
    def get_client(): """Get DevHub API client and base_url.""" client = OAuth1Session( os.environ['DEVHUB_API_KEY'], client_secret=os.environ['DEVHUB_API_SECRET']) base_url = '{}/api/v2/'.format(os.environ['DEVHUB_BASE_URL']) return client, base_url

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