asana_get_project_task_counts
Retrieve task counts for Asana projects to monitor progress and manage workloads by providing project IDs.
Instructions
Get the number of tasks in a project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project ID to get task counts for | |
| opt_fields | No | Comma-separated list of optional fields to include |
Input Schema (JSON Schema)
{
"properties": {
"opt_fields": {
"description": "Comma-separated list of optional fields to include",
"type": "string"
},
"project_id": {
"description": "The project ID to get task counts for",
"type": "string"
}
},
"required": [
"project_id"
],
"type": "object"
}
Implementation Reference
- src/tool-handler.ts:206-212 (handler)The main tool handler switch case that executes the tool logic by calling asanaClient.getProjectTaskCounts with project_id and opts, then returns the JSON-stringified response.case "asana_get_project_task_counts": { const { project_id, ...opts } = args; const response = await asanaClient.getProjectTaskCounts(project_id, opts); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- src/tools/project-tools.ts:64-81 (schema)Tool schema definition with input schema requiring project_id and optional opt_fields.export const getProjectTaskCountsTool: Tool = { name: "asana_get_project_task_counts", description: "Get the number of tasks in a project", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "The project ID to get task counts for" }, opt_fields: { type: "string", description: "Comma-separated list of optional fields to include" } }, required: ["project_id"] } };
- src/tool-handler.ts:61-103 (registration)Registration of the tool in the main tools array exported for MCP.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, getStoriesForTaskTool, createTaskStoryTool, getTeamsForUserTool, getTeamsForWorkspaceTool, addMembersForProjectTool, addFollowersForProjectTool, getUsersForWorkspaceTool, getAttachmentsForObjectTool, uploadAttachmentForObjectTool, downloadAttachmentTool ];
- src/asana-client-wrapper.ts:431-445 (helper)Core implementation in AsanaClientWrapper that calls the Asana API getTaskCountsForProject with predefined opt_fields for task counts.async getProjectTaskCounts(projectId: string, opts: any = {}) { // Ensure we always include essential opt_fields for task counts // See: https://developers.asana.com/reference/gettaskcountsforproject const options = { opt_fields: 'num_tasks,num_incomplete_tasks,num_completed_tasks,num_milestones,num_incomplete_milestones,num_completed_milestones' }; // If caller provided specific opt_fields, use those instead if (opts.opt_fields) { options.opt_fields = opts.opt_fields; } const response = await this.projects.getTaskCountsForProject(projectId, options); return response.data; }
- src/utils/validation.ts:265-270 (helper)Parameter validation ensuring project_id is a valid Asana GID.case 'asana_get_project': case 'asana_get_project_task_counts': case 'asana_get_project_sections': result = validateGid(params.project_id, 'project_id'); if (!result.valid) errors.push(...result.errors); break;