update_hours
Modify the hours of operation for a DevHub location by providing a structured list of time ranges. Specify days and up to four ranges per day, such as 9am-5pm or closed. Input includes location ID and optional hours type.
Instructions
Update the hours of operation for a DevHub location
Send 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
new_hours: Structured format of the new hours
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 | ||
| new_hours | Yes |
Implementation Reference
- src/devhub_cms_mcp/server.py:109-142 (handler)The main handler function for the 'update_hours' tool, decorated with @mcp.tool() for registration. It updates the hours of operation for a specified location by making a PUT request to the DevHub API with the new hours data.@mcp.tool() def update_hours(location_id: int, new_hours: list, hours_type: str = 'primary') -> str: """Update the hours of operation for a DevHub location Send 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 new_hours: Structured format of the new hours hours_type: Defaults to 'primary' unless the user specifies a different type """ client, base_url = get_client() r = client.put( '{}locations/{}/'.format(base_url, location_id), json={ 'hours': [ { 'type': hours_type, 'hours': new_hours, } ] }, ) content = json.loads(r.content) return 'Updated successfully'
- src/devhub_cms_mcp/server.py:109-109 (registration)The @mcp.tool() decorator registers the update_hours function as an MCP tool.@mcp.tool()
- src/devhub_cms_mcp/server.py:15-21 (helper)Helper function get_client() used by update_hours to obtain the authenticated API client and 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