Skip to main content
Glama

get_businesses

Retrieve a list of businesses within the DevHub account, including IDs and names, to streamline business-specific operations in the DevHub CMS MCP system.

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 and registration for the 'get_businesses' MCP tool. The @mcp.tool() decorator registers the function as a tool named 'get_businesses'. The function fetches businesses from the DevHub API endpoint, filtering non-deleted ones ordered by name, and returns the list of business objects.
    @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 docstring of the get_businesses function defines the tool's schema, describing no input parameters and the output format as a list of businesses with id and business_name fields.
    """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 get_client() used by get_businesses to obtain the OAuth1 authenticated client session and DevHub API base URL from environment variables.
    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

Other Tools

Related Tools

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