asana_add_followers_for_project
Add users as followers to an Asana project to keep them updated on progress and changes.
Instructions
Add followers to a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project ID to add followers to | |
| followers | Yes | Array of user GIDs to add as followers to the project | |
| opt_fields | No | Comma-separated list of optional fields to include in the response |
Implementation Reference
- src/asana-client-wrapper.ts:1296-1337 (handler)Core handler method in AsanaClientWrapper that adds followers to a project via Asana ProjectsApi or direct API call fallback.async addFollowersForProject(projectId: string, followers: any) { try { const followersArray = this.ensureArray(followers); const body = { data: { followers: followersArray } }; const response = await this.projects.addFollowersForProject(body, projectId); return response.data; } catch (error: any) { console.error(`Error adding followers to project: ${error}`); // Adăugăm mai multe detalii despre eroare pentru debugging if (error.response && error.response.body) { console.error(`Response error details: ${JSON.stringify(error.response.body, null, 2)}`); } // Dacă metoda standard eșuează, încercăm metoda alternativă cu callApi direct try { const client = Asana.ApiClient.instance; const followersArray = this.ensureArray(followers); const response = await client.callApi( `/projects/${projectId}/addFollowers`, 'POST', { project_gid: projectId }, {}, {}, {}, { data: { followers: followersArray } }, ['token'], ['application/json'], ['application/json'], 'Blob' ); return response.data; } catch (fallbackError) { console.error("Error in fallback method for adding followers:", fallbackError); throw fallbackError; } } }
- src/tool-handler.ts:478-484 (handler)Dispatch handler in central tool_handler function that calls the AsanaClientWrapper method.case "asana_add_followers_for_project": { const { project_id, followers, ...opts } = args; const response = await asanaClient.addFollowersForProject(project_id, followers); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- src/tools/project-tools.ts:312-336 (schema)MCP Tool definition including name, description, and inputSchema.export const addFollowersForProjectTool: Tool = { name: "asana_add_followers_for_project", description: "Add followers to a project", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "The project ID to add followers to" }, followers: { type: "array", items: { type: "string" }, description: "Array of user GIDs to add as followers to the project" }, opt_fields: { type: "string", description: "Comma-separated list of optional fields to include in the response" } }, required: ["project_id", "followers"] } };
- src/tool-handler.ts:97-103 (registration)Tool registration in the exported tools array used for MCP server.addMembersForProjectTool, addFollowersForProjectTool, getUsersForWorkspaceTool, getAttachmentsForObjectTool, uploadAttachmentForObjectTool, downloadAttachmentTool ];
- src/utils/validation.ts:301-310 (helper)Input parameter validation ensuring project_id is valid GID and followers array is provided.case 'asana_add_members_for_project': case 'asana_add_followers_for_project': result = validateGid(params.project_id, 'project_id'); if (!result.valid) errors.push(...result.errors); const arrayParam = toolName === 'asana_add_members_for_project' ? 'members' : 'followers'; if (!params[arrayParam]) { errors.push(`${arrayParam} is required`); } break;