get_hours_of_operation
Retrieve weekly hours of operation for a DevHub location, including time ranges for each day. Specify a location ID to return open and closed schedules, with support for breaks like lunch hours.
Instructions
Get the hours of operation for a DevHub location
Returns a list of items representing days of the week
Except for the special case formatting, this object is a list of 7 items which represent each day.
Each day can can have one-four time ranges. For example, two time ranges denotes a "lunch-break". No time ranges denotes closed.
Examples:
9am-5pm [["09:00:00", "17:00:00"]]
9am-12pm and 1pm-5pm [["09:00:00", "12:00:00"], ["13:00:00", "17:00:00"]]
Closed - an empty list []
Args:
location_id: DevHub Location ID
hours_type: Defaults to 'primary' unless the user specifies a different type
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hours_type | No | primary | |
| location_id | Yes |
Implementation Reference
- src/devhub_cms_mcp/server.py:24-47 (handler)The handler function for the 'get_hours_of_operation' tool. It uses the @mcp.tool() decorator for registration and implements the logic to fetch hours from the DevHub API via an authenticated GET request.@mcp.tool() def get_hours_of_operation(location_id: int, hours_type: str = 'primary') -> list: """Get the hours of operation for a DevHub location Returns a list of items representing days of the week Except for the special case formatting, this object is a list of 7 items which represent each day. Each day can can have one-four time ranges. For example, two time ranges denotes a "lunch-break". No time ranges denotes closed. Examples: 9am-5pm [["09:00:00", "17:00:00"]] 9am-12pm and 1pm-5pm [["09:00:00", "12:00:00"], ["13:00:00", "17:00:00"]] Closed - an empty list [] Args: location_id: DevHub Location ID hours_type: Defaults to 'primary' unless the user specifies a different type """ client, base_url = get_client() r = client.get('{}locations/{}'.format(base_url, location_id)) content = json.loads(r.content) return content['hours_by_type'].get(hours_type, [])
- src/devhub_cms_mcp/server.py:15-21 (helper)Shared helper function used by get_hours_of_operation (and other tools) to create an OAuth1 authenticated client session and the API base URL.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
- src/devhub_cms_mcp/server.py:24-24 (registration)The @mcp.tool() decorator registers the get_hours_of_operation function as an MCP tool.@mcp.tool()