Skip to main content
Glama

getTime

Retrieve logged time entries from Teamwork projects with filters for date ranges, project status, billing status, and sorting options to track work hours and generate reports.

Instructions

Get all time entries. Return all logged time entries for all projects. Only the time entries that the logged-in user can access will be returned.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
updatedAfterNofilter by updated after date
startDateNofilter by a starting date
reportFormatNodefine the format of the report
projectStatusNofilter by project status
orderModeNoorder mode
orderByNosort order
invoicedTypeNofilter by invoiced type
endDateNofilter by an ending date
billableTypeNofilter by billable type
updatedByNofilter by the user who updated the timelog
ticketIdNofilter by ticket id
tasklistIdNofilter by tasklist id
taskIdNofilter by task id (deprecated, use taskIds)
projectIdNofilter by project id (deprecated, use projectIds)
pageSizeNonumber of items in a page
pageNopage number
invoiceIdNofilter by invoice id
budgetIdNofilter by budget id
allocationIdNofilter by allocation id

Implementation Reference

  • MCP tool handler for 'getTime'. Calls the service with input params and returns JSON stringified response or error.
    export async function handleGetTime(input: any) { try { logger.info('Handling getTime tool request'); const response = await getTimeService(input); logger.info('Successfully handled getTime request'); return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Getting time entries'); } }
  • Tool schema/definition for 'getTime' including inputSchema for parameters like dates, filters, pagination, etc.
    export const getTimeDefinition = { name: "getTime", description: "Get all time entries. Return all logged time entries for all projects. Only the time entries that the logged-in user can access will be returned.", inputSchema: { type: 'object', properties: { updatedAfter: { type: 'string', description: 'filter by updated after date' }, startDate: { type: 'string', description: 'filter by a starting date' }, reportFormat: { type: 'string', description: 'define the format of the report' }, projectStatus: { type: 'string', description: 'filter by project status', enum: [ 'active', 'current', 'late', 'upcoming', 'completed', 'deleted' ] }, orderMode: { type: 'string', description: 'order mode', enum: [ 'asc', 'desc' ] }, orderBy: { type: 'string', description: 'sort order', enum: [ 'company', 'date', 'dateupdated', 'project', 'task', 'tasklist', 'user', 'description', 'billed', 'billable', 'timespent' ] }, invoicedType: { type: 'string', description: 'filter by invoiced type', enum: [ 'all', 'invoiced', 'noninvoiced' ] }, endDate: { type: 'string', description: 'filter by an ending date' }, billableType: { type: 'string', description: 'filter by billable type', enum: [ 'all', 'billable', 'non-billable' ] }, updatedBy: { type: 'integer', description: 'filter by the user who updated the timelog' }, ticketId: { type: 'integer', description: 'filter by ticket id' }, tasklistId: { type: 'integer', description: 'filter by tasklist id' }, taskId: { type: 'integer', description: 'filter by task id (deprecated, use taskIds)' }, projectId: { type: 'integer', description: 'filter by project id (deprecated, use projectIds)' }, pageSize: { type: 'integer', description: 'number of items in a page' }, page: { type: 'integer', description: 'page number' }, invoiceId: { type: 'integer', description: 'filter by invoice id' }, budgetId: { type: 'integer', description: 'filter by budget id' }, allocationId: { type: 'integer', description: 'filter by allocation id' } }, required: [] }, annotations: { title: "Get Time Entries", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of 'getTime' tool in the toolPairs array, mapping definition to handler for toolHandlersMap.
    { definition: getTime, handler: handleGetTime },
  • Core service function getTime that makes API call to '/time.json' with params and returns data. Called by the tool handler.
    export const getTime = async (params: GetTimeParams = {}) => { try { logger.info('Fetching time entries from Teamwork'); const api = getApiClientForVersion('v3'); logger.info('Making API request to get time entries'); const response = await api.get('/time.json', { params }); logger.info('Successfully retrieved time entries'); return response.data; } catch (error: any) { logger.error(`Failed to get time entries: ${error.message}`); throw new Error(`Failed to get time entries: ${error.message}`); } };

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/Vizioz/Teamwork-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server