Skip to main content
Glama

addPeopleToProject

Add users to a Teamwork project by specifying project and user IDs, enabling team collaboration management.

Instructions

Add people to a specific project in Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe ID of the project to add people to
userIdsYesArray of user IDs to add to the project
checkTeamIdsNoOptional array of team IDs to check

Implementation Reference

  • The handler function for the 'addPeopleToProject' tool. Validates input parameters (projectId, userIds, optional checkTeamIds), prepares the payload, calls the teamwork service, handles the response, and returns formatted output or errors.
    export async function handleAddPeopleToProject(input: any) {
      logger.info('=== addPeopleToProject tool called ===');
      logger.info(`Input parameters: ${JSON.stringify(input || {})}`);
      
      try {
        if (!input.projectId) {
          logger.error('Missing required parameter: projectId');
          return {
            content: [{
              type: "text",
              text: "Error: Missing required parameter 'projectId'"
            }]
          };
        }
        
        if (!input.userIds || !Array.isArray(input.userIds) || input.userIds.length === 0) {
          logger.error('Missing or invalid required parameter: userIds');
          return {
            content: [{
              type: "text",
              text: "Error: Missing or invalid required parameter 'userIds'. Must be a non-empty array of user IDs."
            }]
          };
        }
        
        const projectId = parseInt(input.projectId, 10);
        if (isNaN(projectId)) {
          logger.error(`Invalid projectId: ${input.projectId}`);
          return {
            content: [{
              type: "text",
              text: `Error: Invalid projectId. Must be a number.`
            }]
          };
        }
        
        // Prepare the payload with proper typing
        const payload: AddPeopleToProjectPayload = {
          userIds: input.userIds
        };
        
        // Add checkTeamIds if provided
        if (input.checkTeamIds && Array.isArray(input.checkTeamIds)) {
          payload.checkTeamIds = input.checkTeamIds;
        }
        
        logger.info(`Calling teamworkService.addPeopleToProject(${projectId}, ${JSON.stringify(payload)})`);
        const result = await teamworkService.addPeopleToProject(projectId, payload);
        
        // Debug the response
        logger.info(`Add people to project response type: ${typeof result}`);
        
        try {
          const jsonString = JSON.stringify(result, null, 2);
          logger.info(`Successfully stringified response`);
          logger.info('=== addPeopleToProject 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 formatting response: ${jsonError.message}`
            }]
          };
        }
      } catch (error: any) {
        return createErrorResponse(error, 'Adding people to project');
      }
    } 
  • The tool definition object including the name, description, inputSchema for parameter validation (projectId: integer required, userIds: array of integers required, checkTeamIds: optional array of integers), and annotations.
    export const addPeopleToProjectDefinition = {
      name: "addPeopleToProject",
      description: "Add people to a specific project in Teamwork",
      inputSchema: {
        type: "object",
        properties: {
          projectId: {
            type: "integer",
            description: "The ID of the project to add people to"
          },
          userIds: {
            type: "array",
            items: {
              type: "integer"
            },
            description: "Array of user IDs to add to the project"
          },
          checkTeamIds: {
            type: "array",
            items: {
              type: "integer"
            },
            description: "Optional array of team IDs to check"
          }
        },
        required: ["projectId", "userIds"]
      },
      annotations: {
        title: "Add People to Project",
        readOnlyHint: false,
        destructiveHint: false,
        openWorldHint: false
      }
    };
  • Registration of the 'addPeopleToProject' tool in the toolPairs array, pairing the definition and handler for inclusion in toolDefinitions and toolHandlersMap.
    { definition: addPeopleToProject, handler: handleAddPeopleToProject },
  • The core service function that performs the API call to add people to a project using the Teamwork API PUT /projects/{projectId}/people.json endpoint.
    export const addPeopleToProject = async (projectId: number, payload: AddPeopleToProjectPayload) => {
      try {
        logger.info(`Adding people to project ID ${projectId} in Teamwork API`);
        logger.info(`Payload: ${JSON.stringify(payload)}`);
        
        const api = ensureApiClient();
        const response = await api.put(`/projects/${projectId}/people.json`, payload);
        logger.info(`Successfully added people to project ID ${projectId}`);
        return response.data;
      } catch (error: any) {
        logger.error(`Teamwork API error: ${error.message}`);
        throw new Error(`Failed to add people to project ID ${projectId} in Teamwork API`);
      }
    };
  • TypeScript interface defining the payload structure for adding people to a project: required userIds array and optional checkTeamIds array.
    export interface AddPeopleToProjectPayload {
      userIds: number[];
      checkTeamIds?: number[];
    }
Behavior3/5

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

Annotations indicate this is a non-destructive, non-read-only operation (readOnlyHint: false, destructiveHint: false), which the description aligns with by implying a write action ('Add'). However, the description adds minimal behavioral context beyond annotations—it doesn't mention permissions needed, rate limits, whether it's idempotent, or what happens on success/failure. With annotations covering basic safety, this earns a baseline score.

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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every part of the description earns its place by conveying essential information.

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

Completeness3/5

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

For a mutation tool with no output schema, the description is minimally adequate. It clarifies the tool's purpose but lacks details on behavioral outcomes (e.g., what's returned, error conditions) or integration with siblings. Given the annotations provide basic safety info, it's complete enough to avoid confusion but leaves gaps for effective agent 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 description coverage is 100%, with clear parameter documentation in the schema itself. The description adds no additional meaning about parameters beyond what's in the schema (e.g., no examples, format details, or constraints like user ID sources). This meets the baseline for high schema coverage but doesn't enhance parameter understanding.

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

Purpose4/5

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

The description clearly states the action ('Add people') and target resource ('to a specific project in Teamwork'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'getProjectPeople' or 'updatePerson' that might involve project people management, leaving room for ambiguity about when to choose this tool over alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'getProjectPeople' (for viewing project members) and 'updatePerson' (which might modify user-project relationships), there's no indication of prerequisites, appropriate contexts, or exclusions. The agent must infer usage from the tool name alone.

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