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
| Name | Required | Description | Default |
|---|---|---|---|
| workspace_gid | No | The workspace GID to get teams for (optional if DEFAULT_WORKSPACE_ID is set) | |
| opt_fields | No | Comma-separated list of optional fields to include |
Implementation Reference
- src/asana-client-wrapper.ts:679-696 (handler)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; } }
- src/tool-handler.ts:453-460 (handler)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) }], }; }
- src/tools/user-tools.ts:22-39 (schema)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: [] } };
- src/tool-handler.ts:61-103 (registration)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 ];