Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_get_task

Retrieve detailed information about a specific Asana task using its unique ID, including optional fields for comprehensive task management.

Instructions

Get detailed information about a specific task

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYesThe task ID to retrieve
opt_fieldsNoComma-separated list of optional fields to include

Implementation Reference

  • Tool schema definition including input validation schema for asana_get_task
    export const getTaskTool: Tool = {
      name: "asana_get_task",
      description: "Get detailed information about a specific task",
      inputSchema: {
        type: "object",
        properties: {
          task_id: {
            type: "string",
            description: "The task ID to retrieve"
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include"
          }
        },
        required: ["task_id"]
      }
    };
  • Registration of all tools including getTaskTool (imported from task-tools) 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
    ];
  • Main handler logic in tool_handler switch statement: destructures arguments, calls asanaClient.getTask, returns JSON response
    case "asana_get_task": {
      const { task_id, ...opts } = args;
      const response = await asanaClient.getTask(task_id, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Core implementation: AsanaClientWrapper.getTask method wraps Asana SDK tasks.getTask call
    async getTask(taskId: string, opts: any = {}) {
      try {
        const response = await this.tasks.getTask(taskId, opts);
        return response.data;
      } catch (error: any) {
        console.error(`Error retrieving task ${taskId}: ${error.message}`);
        // Adăugăm informații utile pentru diagnosticare
        if (error.response && error.response.body) {
          console.error(`Response error details: ${JSON.stringify(error.response.body, null, 2)}`);
        }
        throw error;
      }
    }
  • Parameter validation specifically for task_id GID format in validateTaskParameters called before handler execution
    case 'asana_get_task':
      result = validateGid(params.task_id, 'task_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