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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/devhub_cms_mcp/server.py:49-69 (handler)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']
- src/devhub_cms_mcp/server.py:49-49 (registration)The @mcp.tool() decorator registers the get_businesses function as an MCP tool.@mcp.tool()
- src/devhub_cms_mcp/server.py:50-58 (schema)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. """
- src/devhub_cms_mcp/server.py:15-21 (helper)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