Skip to main content
Glama

getTime

Retrieve all time entries you can access. Filter by date, project, task, or other criteria to 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

  • Handler function for the getTime tool. Calls the getTime service and returns the response as text content, or returns an error response on failure.
    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 definition including name, description, inputSchema with all filter parameters, and annotations.
    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
      }
    };
  • Service/helper that makes the actual API call to Teamwork's v3 API endpoint /time.json with the provided query parameters.
    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}`);
      }
    };
    
    export default getTime; 
  • TypeScript interface defining all optional parameters for the getTime service call.
    export interface GetTimeParams {
      updatedAfter?: string;
      startDate?: string;
      reportFormat?: string;
      projectStatus?: 'active' | 'current' | 'late' | 'upcoming' | 'completed' | 'deleted';
      orderMode?: 'asc' | 'desc';
      orderBy?: 'company' | 'date' | 'dateupdated' | 'project' | 'task' | 'tasklist' | 'user' | 'description' | 'billed' | 'billable' | 'timespent';
      invoicedType?: 'all' | 'invoiced' | 'noninvoiced';
      endDate?: string;
      billableType?: 'all' | 'billable' | 'non-billable';
      updatedBy?: number;
      ticketId?: number;
      tasklistId?: number;
      taskId?: number;
      projectId?: number;
      pageSize?: number;
      page?: number;
      invoiceId?: number;
      budgetId?: number;
      allocationId?: number;
      useFallbackMethod?: boolean;
      unattachedTimelogs?: boolean;
      skipCounts?: boolean;
      showDeleted?: boolean;
      returnCostInfo?: boolean;
      returnBillableInfo?: boolean;
      onlyStarredProjects?: boolean;
      matchAllTaskTags?: boolean;
      matchAllTags?: boolean;
      matchAllProjectTags?: boolean;
      isReportDownload?: boolean;
      includeTotals?: boolean;
      includePermissions?: boolean;
      includeDescendants?: boolean;
      includeArchivedProjects?: boolean;
      taskTagIds?: number[];
      taskStatuses?: string[];
      taskIds?: number[];
      tagIds?: number[];
      selectedColumns?: string[];
      projectsFromCompanyId?: number[];
      projectTagIds?: number[];
      projectStatuses?: string[];
      projectOwnerIds?: number[];
      projectIds?: number[];
      projectHealths?: number[];
      projectCompanyIds?: number[];
      projectCategoryIds?: number[];
      include?: string[];
      ids?: number[];
      'fields[users]'?: string[];
      'fields[timelogs]'?: string[];
      'fields[tasks]'?: string[];
      'fields[tasklists]'?: string[];
      'fields[tags]'?: string[];
      'fields[projects]'?: string[];
      'fields[projectcategories]'?: string[];
      'fields[companies]'?: string[];
      assignedToUserIds?: number[];
      assignedToTeamIds?: number[];
      assignedToCompanyIds?: number[];
      assignedTeamIds?: number[];
    }
  • Registration of the getTime tool: imports the definition and handler, adds it to the toolPairs array, and maps it by name ('getTime') in toolHandlersMap.
    import { getTimeDefinition as getTime, handleGetTime } from './time/getTime.js';
    import { getProjectsAllocationsTimeDefinition as getAllocationTime, handleGetProjectsAllocationsTime } from './time/getAllocationTime.js';
    
    // Core
    import { getTimezonesDefinition as getTimezones, handleGetTimezones } from './core/getTimezones.js';
    
    // Define a structure that pairs tool definitions with their handlers
    interface ToolPair {
      definition: any;
      handler: Function;
    }
    
    // Create an array of tool pairs
    const toolPairs: ToolPair[] = [
      { definition: getProjects, handler: handleGetProjects },
      { definition: getCurrentProject, handler: handleGetCurrentProject },
      { definition: createProject, handler: handleCreateProject },
      { definition: getTasks, handler: handleGetTasks },
      { definition: getTasksByProjectId, handler: handleGetTasksByProjectId },
      { definition: getTaskListsByProjectId, handler: handleGetTaskListsByProjectId },
      { definition: getTasksByTaskListId, handler: handleGetTasksByTaskListId },
      { definition: getTaskById, handler: handleGetTaskById },
      { definition: createTask, handler: handleCreateTask },
      { definition: createSubTask, handler: handleCreateSubTask },
      { definition: updateTask, handler: handleUpdateTask },
      { definition: deleteTask, handler: handleDeleteTask },
      { definition: getTasksMetricsComplete, handler: handleGetTasksMetricsComplete },
      { definition: getTasksMetricsLate, handler: handleGetTasksMetricsLate },
      { definition: getTaskSubtasks, handler: handleGetTaskSubtasks },
      { definition: getTaskComments, handler: handleGetTaskComments },
      { definition: createComment, handler: handleCreateComment },
      { definition: getPeople, handler: handleGetPeople },
      { definition: getPersonById, handler: handleGetPersonById },
      { definition: getProjectPeople, handler: handleGetProjectPeople },
      { definition: addPeopleToProject, handler: handleAddPeopleToProject },
      { definition: deletePerson, handler: handleDeletePerson },
      { definition: updatePerson, handler: handleUpdatePerson },
      { definition: createCompany, handler: handleCreateCompany },
      { definition: updateCompany, handler: handleUpdateCompany },
      { definition: deleteCompany, handler: handleDeleteCompany },
      { definition: getCompanies, handler: handleGetCompanies },
      { definition: getCompanyById, handler: handleGetCompanyById },
      { definition: getProjectsPeopleMetricsPerformance, handler: handleGetProjectsPeopleMetricsPerformance },
      { definition: getProjectsPeopleUtilization, handler: handleGetProjectsPeopleUtilization },
      { definition: getAllocationTime, handler: handleGetProjectsAllocationsTime },
      { definition: getTime, handler: handleGetTime },
      { definition: getProjectPerson, handler: handleGetProjectPerson },
      { definition: getProjectsReportingUserTaskCompletion, handler: handleGetProjectsReportingUserTaskCompletion },
      { definition: getProjectsReportingUtilization, handler: handleGetProjectsReportingUtilization },
      { definition: getTimezones, handler: handleGetTimezones }
    ];
    
    // Extract just the definitions for the toolDefinitions array
    export const toolDefinitions = toolPairs.map(pair => pair.definition);
    
    // Create a map of tool names to their handler functions
    export const toolHandlersMap: Record<string, Function> = toolPairs.reduce((map, pair) => {
      map[pair.definition.name] = pair.handler;
      return map;
    }, {} as Record<string, Function>);
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description indicates a read operation ('Return all logged time entries'), but the annotation readOnlyHint is false, suggesting potential mutation. This contradiction undermines transparency. Additionally, no behavioral details like pagination or rate limits are provided.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose, no fluff. Efficiently conveys core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 19 parameters and no output schema, the description is minimal. It does not explain return format, pagination, filtering behavior, or how parameters interact. More context is needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds no parameter semantics beyond what the schema already provides. No examples or usage patterns are given.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get all time entries' and specifies that it returns all logged time entries for all projects accessible to the user. This is specific and distinguishes from sibling tools like getTasks or getProjects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives. The description does not provide any context about when to choose getTime over other tools like getTasks or getProjects, nor does it mention any prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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