Skip to main content
Glama
by cristip73

asana_get_tasks_for_project

Retrieve all tasks from a specific Asana project with pagination support, filtering options for completed/incomplete tasks, and customizable result limits.

Instructions

Get all tasks from a specific project with pagination support

Input Schema

NameRequiredDescriptionDefault
project_idYesThe project ID to get tasks for
completedNoFilter for completed or incomplete tasks
limitNoMaximum number of results to return (1-100)
offsetNoPagination token from previous response
auto_paginateNoAutomatically fetch all pages of results (up to max_pages)
max_pagesNoMaximum number of pages to fetch when auto_paginate is true
opt_fieldsNoComma-separated list of optional fields to include

Input Schema (JSON Schema)

{ "properties": { "auto_paginate": { "default": false, "description": "Automatically fetch all pages of results (up to max_pages)", "type": "boolean" }, "completed": { "description": "Filter for completed or incomplete tasks", "type": "boolean" }, "limit": { "description": "Maximum number of results to return (1-100)", "maximum": 100, "minimum": 1, "type": "number" }, "max_pages": { "default": 10, "description": "Maximum number of pages to fetch when auto_paginate is true", "type": "number" }, "offset": { "description": "Pagination token from previous response", "type": "string" }, "opt_fields": { "description": "Comma-separated list of optional fields to include", "type": "string" }, "project_id": { "description": "The project ID to get tasks for", "type": "string" } }, "required": [ "project_id" ], "type": "object" }

Implementation Reference

  • MCP tool handler switch case that destructures input arguments and delegates execution to AsanaClientWrapper.getTasksForProject
    case "asana_get_tasks_for_project": { const { project_id, ...opts } = args; const response = await asanaClient.getTasksForProject(project_id, opts); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
  • Tool object defining the name, description, and input schema for validation and introspection
    export const getTasksForProjectTool: Tool = { name: "asana_get_tasks_for_project", description: "Get all tasks from a specific project with pagination support", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "The project ID to get tasks for" }, completed: { type: "boolean", description: "Filter for completed or incomplete tasks" }, limit: { type: "number", description: "Maximum number of results to return (1-100)", minimum: 1, maximum: 100 }, offset: { type: "string", description: "Pagination token from previous response" }, auto_paginate: { type: "boolean", description: "Automatically fetch all pages of results (up to max_pages)", default: false }, max_pages: { type: "number", description: "Maximum number of pages to fetch when auto_paginate is true", default: 10 }, opt_fields: { type: "string", description: "Comma-separated list of optional fields to include" } }, required: ["project_id"] } };
  • Registration of all tools including getTasksForProjectTool in the exported tools array used by 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 helper method in AsanaClientWrapper that implements the task retrieval logic with pagination support using Asana API
    async getTasksForProject(projectId: string, opts: any = {}) { try { // Extract pagination parameters const { auto_paginate = false, max_pages = 10, limit, offset, opt_fields, completed, ...otherOpts } = opts; // Build search parameters const searchParams: any = { ...otherOpts }; // Add specific filters if (completed !== undefined) searchParams.completed = completed; if (opt_fields) searchParams.opt_fields = opt_fields; // Add pagination parameters if (limit !== undefined) { // Ensure limit is between 1 and 100 searchParams.limit = Math.min(Math.max(1, Number(limit)), 100); } if (offset) searchParams.offset = offset; // Use the paginated results handler for more reliable pagination return await this.handlePaginatedResults( // Initial fetch function () => this.tasks.getTasksForProject(projectId, searchParams), // Next page fetch function (nextOffset) => this.tasks.getTasksForProject(projectId, { ...searchParams, offset: nextOffset }), // Pagination options { auto_paginate, max_pages } ); } catch (error: any) { console.error(`Error getting tasks for project ${projectId}: ${error.message}`); // Add detailed error handling for common issues if (error.message?.includes('Not Found')) { throw new Error(`Project with ID ${projectId} not found or inaccessible.`); } if (error.message?.includes('Bad Request')) { if (opts.limit && (opts.limit < 1 || opts.limit > 100)) { throw new Error(`Invalid limit parameter: ${opts.limit}. Limit must be between 1 and 100.`); } throw new Error(`Error retrieving tasks for project: ${error.message}. Check that all parameters are valid.`); } throw error; } }

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