Skip to main content
Glama
by cristip73

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

NameRequiredDescriptionDefault
project_idYesThe project ID to get task counts for
opt_fieldsNoComma-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

  • 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) }], }; }
  • 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"] } };
  • 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 ];
  • 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; }
  • 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;

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/cristip73/mcp-server-asana'

If you have feedback or need assistance with the MCP directory API, please join our Discord server