asana_add_followers_to_task
Add specific users as followers to an Asana task to keep them informed about task progress and updates.
Instructions
Add followers to a task
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | The task ID to add followers to | |
| followers | Yes | Array of user IDs to add as followers to the task |
Input Schema (JSON Schema)
{
"properties": {
"followers": {
"description": "Array of user IDs to add as followers to the task",
"items": {
"type": "string"
},
"type": "array"
},
"task_id": {
"description": "The task ID to add followers to",
"type": "string"
}
},
"required": [
"task_id",
"followers"
],
"type": "object"
}
Implementation Reference
- src/tool-handler.ts:462-468 (handler)Handler case in the main tool dispatcher that extracts parameters, calls the Asana client wrapper method, and returns the JSON response.case "asana_add_followers_to_task": { const { task_id, followers } = args; const response = await asanaClient.addFollowersToTask(task_id, followers); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- src/asana-client-wrapper.ts:549-585 (helper)Core implementation in AsanaClientWrapper that calls the Asana API to add followers to a task, with fallback direct API call.async addFollowersToTask(taskId: string, followers: any) { // Ensure followers is an array const followersArray = this.ensureArray(followers); try { const body = { data: { followers: followersArray } }; const response = await this.tasks.addFollowersForTask(body, taskId); return response.data; } catch (error) { console.error(`Error adding followers to task: ${error}`); // Dacă metoda standard eșuează, încercăm metoda alternativă cu callApi direct try { const client = Asana.ApiClient.instance; const response = await client.callApi( `/tasks/${taskId}/addFollowers`, 'POST', { task_gid: taskId }, {}, {}, {}, { 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; } } }
- Tool schema definition including name, description, and input schema for parameters task_id and followers array.export const addFollowersToTaskTool: Tool = { name: "asana_add_followers_to_task", description: "Add followers to a task", inputSchema: { type: "object", properties: { task_id: { type: "string", description: "The task ID to add followers to" }, followers: { type: "array", items: { type: "string" }, description: "Array of user IDs to add as followers to the task" } }, required: ["task_id", "followers"] } };
- src/tool-handler.ts:41-92 (registration)Import of the tool from task-relationship-tools and registration in the tools array exported for MCP.addTaskDependenciesTool, addTaskDependentsTool, setParentForTaskTool, addFollowersToTaskTool } from './tools/task-relationship-tools.js'; import { getStoriesForTaskTool, createTaskStoryTool } from './tools/story-tools.js'; import { getTeamsForUserTool, getTeamsForWorkspaceTool, getUsersForWorkspaceTool } from './tools/user-tools.js'; import { getAttachmentsForObjectTool, uploadAttachmentForObjectTool, downloadAttachmentTool } from './tools/attachment-tools.js'; export const tools: Tool[] = [ listWorkspacesTool, searchProjectsTool, getProjectTool, getProjectTaskCountsTool, getProjectSectionsTool, createSectionForProjectTool, createProjectForWorkspaceTool, updateProjectTool, reorderSectionsTool, getProjectStatusTool, getProjectStatusesForProjectTool, createProjectStatusTool, deleteProjectStatusTool, searchTasksTool, getTaskTool, createTaskTool, updateTaskTool, createSubtaskTool, getMultipleTasksByGidTool, addTaskToSectionTool, getTasksForSectionTool, getProjectHierarchyTool, getSubtasksForTaskTool, getTasksForProjectTool, getTasksForTagTool, getTagsForWorkspaceTool, addTagsToTaskTool, addTaskDependenciesTool, addTaskDependentsTool, setParentForTaskTool, addFollowersToTaskTool,
- src/utils/validation.ts:237-244 (helper)Validation logic ensuring task_id is a valid GID and followers array is provided.case 'asana_add_followers_to_task': result = validateGid(params.task_id, 'task_id'); if (!result.valid) errors.push(...result.errors); if (!params.followers) { errors.push('followers is required'); } break;