Skip to main content
Glama
cristip73

MCP Server for Asana

by cristip73

asana_get_teams_for_workspace

Retrieve teams within a specific Asana workspace to organize and manage team-based projects and tasks.

Instructions

Get teams in a workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_gidNoThe workspace GID to get teams for (optional if DEFAULT_WORKSPACE_ID is set)
opt_fieldsNoComma-separated list of optional fields to include

Implementation Reference

  • Core handler implementation: AsanaClientWrapper.getTeamsForWorkspace method that calls the Asana Teams API to fetch teams for the given workspace_gid (or default), with error handling.
    async getTeamsForWorkspace(workspace_gid: string | undefined, opts: any = {}) {
      try {
        // Use default workspace if not specified and available
        if (!workspace_gid && this.defaultWorkspaceId) {
          workspace_gid = this.defaultWorkspaceId;
        }
        
        if (!workspace_gid) {
          throw new Error("No workspace specified and no default workspace ID set");
        }
        
        const response = await this.teams.getTeamsForWorkspace(workspace_gid, opts);
        return response.data;
      } catch (error) {
        console.error(`Error in getTeamsForWorkspace: ${error}`);
        throw error;
      }
    }
  • Tool dispatch handler in tool_handler switch statement that extracts parameters and delegates to AsanaClientWrapper.getTeamsForWorkspace.
    case "asana_get_teams_for_workspace": {
      const { workspace_gid, ...opts } = args;
      const response = await asanaClient.getTeamsForWorkspace(workspace_gid || undefined, opts);
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Tool schema definition including name, description, and inputSchema for parameter validation.
    export const getTeamsForWorkspaceTool: Tool = {
      name: "asana_get_teams_for_workspace",
      description: "Get teams in a workspace",
      inputSchema: {
        type: "object",
        properties: {
          workspace_gid: {
            type: "string",
            description: "The workspace GID to get teams for (optional if DEFAULT_WORKSPACE_ID is set)"
          },
          opt_fields: {
            type: "string",
            description: "Comma-separated list of optional fields to include"
          }
        },
        required: []
      }
    };
  • Tool registration: getTeamsForWorkspaceTool is imported and included 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
    ];

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