getTimezones
Retrieve available timezones from Teamwork to update user timezone settings and ensure accurate scheduling across projects.
Instructions
Get all timezones available in Teamwork. This is useful when you need to update a user's timezone and need to know the available options.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/core/getTimezones.ts:28-44 (handler)The main handler function for the getTimezones tool. It invokes the teamworkService to retrieve timezones, formats the result as JSON text content, and handles errors using createErrorResponse.export async function handleGetTimezones() { logger.info('Calling teamworkService.getTimezones()'); try { const result = await teamworkService.getTimezones(); logger.info('Successfully retrieved timezones'); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Retrieving timezones'); } }
- src/tools/core/getTimezones.ts:11-25 (schema)The schema/definition for the getTimezones tool, including name, description, empty input schema (no parameters), and annotations indicating it's read-only and non-destructive.export const getTimezonesDefinition = { name: "getTimezones", description: "Get all timezones available in Teamwork. This is useful when you need to update a user's timezone and need to know the available options.", inputSchema: { type: 'object', properties: {}, required: [] }, annotations: { title: "Get Timezones", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
- src/tools/index.ts:101-101 (registration)Registration of the getTimezones tool in the central toolPairs array in src/tools/index.ts, associating its definition and handler for use in toolHandlersMap and toolDefinitions.{ definition: getTimezones, handler: handleGetTimezones }
- Supporting service function that performs the actual API call to retrieve timezones from Teamwork using the v1 endpoint 'timezones.json', called by the tool handler.export const getTimezones = async () => { try { logger.info('Fetching all timezones'); const api = getApiClientForVersion('v1'); // Note: This is a v1 API endpoint without the projects/api/v3 prefix const response = await api.get('timezones.json'); logger.info(`Successfully retrieved ${response.data.timezones?.length || 0} timezones`); return response.data; } catch (error: any) { logger.error(`Error fetching timezones: ${error.message}`); throw new Error(`Failed to fetch timezones: ${error.message}`); } };