Skip to main content
Glama

getProjects

Retrieve and filter Teamwork projects with customizable parameters for reporting, analysis, and project management oversight.

Instructions

Get all projects from Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
updatedAfterNoFilter projects updated after this date-time (format: ISO 8601)
timeModeNoProfitability time mode
searchTermNoFilter by project name
reportTypeNoDefine the type of the report
reportTimezoneNoConfigure the report dates displayed in a timezone
reportFormatNoDefine the format of the report
projectTypeNoFilter by project type
orderModeNoOrder mode
orderByNoOrder by field
notCompletedBeforeNoFilter by projects that have not been completed before the given date (format: YYYY-MM-DD)
minLastActivityDateNoFilter by min last activity date (format: YYYY-MM-DD)
maxLastActivityDateNoFilter by max last activity date (format: YYYY-MM-DD)
userIdNoFilter by user id
pageSizeNoNumber of items in a page (not used when generating reports)
pageNoPage number (not used when generating reports)
orderByCustomFieldIdNoOrder by custom field id when orderBy is equal to customfield
minBudgetCapacityUsedPercentNoFilter by minimum budget capacity used
maxBudgetCapacityUsedPercentNoFilter by maximum budget capacity used
includeArchivedProjectsNoInclude archived projects
includeCompletedProjectsNoInclude completed projects
includeProjectOwnerNoInclude project owner
includeProjectCreatorNoInclude project creator
includeProjectCompanyNoInclude project company
includeProjectCategoryNoInclude project category
includeProjectTagsNoInclude project tags
includeProjectStatusNoInclude project status
includeProjectHealthNoInclude project health
includeProjectBudgetNoInclude project budget
includeProjectProfitabilityNoInclude project profitability
includeProjectCustomFieldsNoInclude project custom fields
includeProjectBillingMethodNoInclude project billing method
includeProjectRateCardsNoInclude project rate cards
includeProjectRateCardRatesNoInclude project rate card rates
includeProjectRateCardCurrenciesNoInclude project rate card currencies
includeProjectRateCardUsersNoInclude project rate card users
includeProjectRateCardUserRatesNoInclude project rate card user rates
includeProjectRateCardUserCurrenciesNoInclude project rate card user currencies
includeProjectRateCardTasksNoInclude project rate card tasks
includeProjectRateCardTaskRatesNoInclude project rate card task rates
includeProjectRateCardTaskCurrenciesNoInclude project rate card task currencies

Implementation Reference

  • The main handler function for the 'getProjects' MCP tool. It processes input parameters, calls the underlying teamworkService.getProjects(), handles various response formats, stringifies the result for output, and manages errors.
    // Tool handler
    export async function handleGetProjects(input: any) {
      logger.info('=== getProjects tool called ===');
      logger.info(`Query parameters: ${JSON.stringify(input || {})}`);
      
      try {
        logger.info('Calling teamworkService.getProjects()');
        const projects = await teamworkService.getProjects(input);
        
        // Debug the response
        logger.info(`Projects response type: ${typeof projects}`);
        
        if (projects === null || projects === undefined) {
          logger.warn('Projects response is null or undefined');
          return {
            content: [{
              type: "text",
              text: "No projects found or API returned empty response."
            }]
          };
        } else if (Array.isArray(projects)) {
          logger.info(`Projects array length: ${projects.length}`);
          if (projects.length === 0) {
            return {
              content: [{
                type: "text",
                text: "No projects found. The API returned an empty array."
              }]
            };
          }
        } else if (typeof projects === 'object') {
          // Check if it's a paginated response with 'projects' property
          if (projects.projects && Array.isArray(projects.projects)) {
            logger.info(`Projects array found in response object. Length: ${projects.projects.length}`);
            if (projects.projects.length === 0) {
              return {
                content: [{
                  type: "text",
                  text: "No projects found. The API returned an empty projects array."
                }]
              };
            }
          } else {
            logger.info(`Projects response is an object: ${JSON.stringify(projects).substring(0, 200)}...`);
          }
        } else {
          logger.info(`Projects response is not an array or object: ${JSON.stringify(projects).substring(0, 200)}...`);
        }
        
        try {
          const jsonString = JSON.stringify(projects, null, 2);
          logger.info(`Successfully stringified projects response`);
          logger.info('=== getProjects tool completed successfully ===');
          return {
            content: [{
              type: "text",
              text: jsonString
            }]
          };
        } catch (jsonError: any) {
          logger.error(`JSON stringify error: ${jsonError.message}`);
          return {
            content: [{
              type: "text",
              text: `Error converting response to JSON: ${jsonError.message}`
            }]
          };
        }
      } catch (error: any) {
        return createErrorResponse(error, 'Retrieving projects');
      }
    } 
  • The schema/definition for the 'getProjects' tool, including name, description, comprehensive inputSchema with numerous filtering, pagination, inclusion, and ordering parameters, and annotations.
    export const getProjectsDefinition = {
      name: "getProjects",
      description: "Get all projects from Teamwork",
      inputSchema: {
        type: "object",
        properties: {
          // String parameters
          updatedAfter: {
            type: "string",
            description: "Filter projects updated after this date-time (format: ISO 8601)"
          },
          timeMode: {
            type: "string",
            enum: ["timelogs", "estimated"],
            description: "Profitability time mode"
          },
          searchTerm: {
            type: "string",
            description: "Filter by project name"
          },
          reportType: {
            type: "string",
            enum: ["project", "health"],
            description: "Define the type of the report"
          },
          reportTimezone: {
            type: "string",
            description: "Configure the report dates displayed in a timezone"
          },
          reportFormat: {
            type: "string",
            enum: ["csv", "html", "pdf", "xls"],
            description: "Define the format of the report"
          },
          projectType: {
            type: "string",
            description: "Filter by project type"
          },
          orderMode: {
            type: "string",
            enum: ["asc", "desc"],
            description: "Order mode"
          },
          orderBy: {
            type: "string",
            enum: ["companyname", "datecreated", "duedate", "lastactivity", "name", "namecaseinsensitive", "ownercompany", "starred", "categoryname"],
            description: "Order by field"
          },
          notCompletedBefore: {
            type: "string",
            description: "Filter by projects that have not been completed before the given date (format: YYYY-MM-DD)"
          },
          minLastActivityDate: {
            type: "string",
            description: "Filter by min last activity date (format: YYYY-MM-DD)"
          },
          maxLastActivityDate: {
            type: "string",
            description: "Filter by max last activity date (format: YYYY-MM-DD)"
          },
          
          // Integer parameters
          userId: {
            type: "integer",
            description: "Filter by user id"
          },
          pageSize: {
            type: "integer",
            description: "Number of items in a page (not used when generating reports)"
          },
          page: {
            type: "integer",
            description: "Page number (not used when generating reports)"
          },
          orderByCustomFieldId: {
            type: "integer",
            description: "Order by custom field id when orderBy is equal to customfield"
          },
          minBudgetCapacityUsedPercent: {
            type: "integer",
            description: "Filter by minimum budget capacity used"
          },
          maxBudgetCapacityUsedPercent: {
            type: "integer",
            description: "Filter by maximum budget capacity used"
          },
          
          // Boolean parameters
          includeArchivedProjects: {
            type: "boolean",
            description: "Include archived projects"
          },
          includeCompletedProjects: {
            type: "boolean",
            description: "Include completed projects"
          },
          includeProjectOwner: {
            type: "boolean",
            description: "Include project owner"
          },
          includeProjectCreator: {
            type: "boolean",
            description: "Include project creator"
          },
          includeProjectCompany: {
            type: "boolean",
            description: "Include project company"
          },
          includeProjectCategory: {
            type: "boolean",
            description: "Include project category"
          },
          includeProjectTags: {
            type: "boolean",
            description: "Include project tags"
          },
          includeProjectStatus: {
            type: "boolean",
            description: "Include project status"
          },
          includeProjectHealth: {
            type: "boolean",
            description: "Include project health"
          },
          includeProjectBudget: {
            type: "boolean",
            description: "Include project budget"
          },
          includeProjectProfitability: {
            type: "boolean",
            description: "Include project profitability"
          },
          includeProjectCustomFields: {
            type: "boolean",
            description: "Include project custom fields"
          },
          includeProjectBillingMethod: {
            type: "boolean",
            description: "Include project billing method"
          },
          includeProjectRateCards: {
            type: "boolean",
            description: "Include project rate cards"
          },
          includeProjectRateCardRates: {
            type: "boolean",
            description: "Include project rate card rates"
          },
          includeProjectRateCardCurrencies: {
            type: "boolean",
            description: "Include project rate card currencies"
          },
          includeProjectRateCardUsers: {
            type: "boolean",
            description: "Include project rate card users"
          },
          includeProjectRateCardUserRates: {
            type: "boolean",
            description: "Include project rate card user rates"
          },
          includeProjectRateCardUserCurrencies: {
            type: "boolean",
            description: "Include project rate card user currencies"
          },
          includeProjectRateCardTasks: {
            type: "boolean",
            description: "Include project rate card tasks"
          },
          includeProjectRateCardTaskRates: {
            type: "boolean",
            description: "Include project rate card task rates"
          },
          includeProjectRateCardTaskCurrencies: {
            type: "boolean",
            description: "Include project rate card task currencies"
          }
        }
      },
      annotations: {
        title: "Get Projects",
        readOnlyHint: false,
        destructiveHint: false,
        openWorldHint: false
      }
    };
  • Registration of the getProjects tool in the central toolPairs array, pairing its definition and handler. This array is used to generate toolDefinitions and toolHandlersMap for MCP.
    // 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 }
    ];
  • The core service function getProjects that performs the actual API calls to Teamwork (/projects.json) with fallback between v3 and v1 APIs. Called by the tool handler via teamworkService.
    export const getProjects = async (params?: ProjectQueryParams) => {
      try {
        logger.info('Fetching projects from Teamwork API');
        
        try {
          // Try with v3 API first
          const api = ensureApiClient();
          const response = await api.get('/projects.json', { params });
          logger.info('Successfully fetched projects using v3 API');
          return response.data;
        } catch (error: any) {
          logger.warn(`V3 API request failed: ${error.message}`);
          
          // Try the v1 API format as fallback
          logger.info('Trying v1 API format as fallback');
          try {
            const v1Api = getApiClientForVersion('v1');
            const v1Response = await v1Api.get('/projects.json', { params });
            logger.info('Successfully fetched projects using v1 API');
            return v1Response.data;
          } catch (v1Error: any) {
            logger.error(`V1 API request also failed: ${v1Error.message}`);
            throw error; // Throw the original error
          }
        }
      } catch (error: any) {
        logger.error(`Teamwork API error: ${error.message}`);
        throw new Error('Failed to fetch projects from Teamwork API');
      }
    };
  • src/tools/index.ts:7-7 (registration)
    Import of the getProjects tool definition and handler into the central tools index for registration.
    import { getProjectsDefinition as getProjects, handleGetProjects } from './projects/getProjects.js';
Behavior2/5

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

Annotations indicate readOnlyHint=false, destructiveHint=false, and openWorldHint=false, but the description adds no behavioral context beyond the basic 'get' action. It doesn't explain what 'get all projects' entails (e.g., pagination, rate limits, authentication needs, or whether it's a list or report generation tool), which is a significant gap given the complex parameter set.

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?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, though its brevity contributes to gaps in other dimensions, but for conciseness alone, it's optimal.

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?

Given the high complexity (40 parameters, no output schema, and no annotations covering behavior), the description is incomplete. It fails to explain the tool's purpose beyond the name, doesn't guide usage, and lacks behavioral details, making it inadequate for an agent to effectively use this tool in context.

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 description coverage is 100%, so the schema fully documents all 40 parameters. The description adds no parameter semantics beyond implying a general 'get' action, which doesn't compensate for the complexity. However, with high schema coverage, the baseline is 3, as the schema carries the burden.

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

Purpose2/5

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

The description 'Get all projects from Teamwork' is a tautology that restates the tool name without adding specificity. It mentions the resource ('projects') but lacks a clear verb beyond 'get' and doesn't distinguish this tool from sibling tools like 'getProjectsAllocationsTime' or 'getCurrentProject'.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, exclusions, or comparisons to sibling tools like 'getCurrentProject' (for a single project) or 'getProjectsReportingUtilization' (for specialized reports), leaving the agent with no usage context.

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