asana_get_teams_for_user
Retrieve all teams a user can access in Asana by providing their user GID or using 'me' for the current user, helping identify team memberships and permissions.
Instructions
Get teams to which the user has access
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_gid | Yes | The user GID to get teams for. Use 'me' to get teams for the current user. | |
| opt_fields | No | Comma-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"
},
"user_gid": {
"description": "The user GID to get teams for. Use 'me' to get teams for the current user.",
"type": "string"
}
},
"required": [
"user_gid"
],
"type": "object"
}
Implementation Reference
- src/tool-handler.ts:446-452 (handler)Switch case in the main tool_handler function that handles the 'asana_get_teams_for_user' tool call by extracting parameters and delegating to AsanaClientWrapper.getTeamsForUsercase "asana_get_teams_for_user": { const { user_gid, ...opts } = args; const response = await asanaClient.getTeamsForUser(user_gid, opts); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- src/asana-client-wrapper.ts:669-677 (handler)Core implementation of getTeamsForUser in AsanaClientWrapper class that calls the Asana TeamsApi to fetch teams for a user and handles errorsasync getTeamsForUser(user_gid: string, opts: any = {}) { try { const response = await this.teams.getTeamsForUser(user_gid, opts); return response.data; } catch (error) { console.error(`Error in getTeamsForUser: ${error}`); throw error; } }
- src/tools/user-tools.ts:3-20 (schema)Tool definition including name, description, and input schema validation for 'asana_get_teams_for_user'export const getTeamsForUserTool: Tool = { name: "asana_get_teams_for_user", description: "Get teams to which the user has access", inputSchema: { type: "object", properties: { user_gid: { type: "string", description: "The user GID to get teams for. Use 'me' to get teams for the current user." }, opt_fields: { type: "string", description: "Comma-separated list of optional fields to include" } }, required: ["user_gid"] } };
- src/tool-handler.ts:61-103 (registration)Registration of all tools including getTeamsForUserTool in the exported tools array used by the MCP serverexport 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 ];
- src/tool-handler.ts:51-54 (registration)Import of the getTeamsForUserTool from user-tools.ts for registration in tool-handler.tsgetTeamsForUserTool, getTeamsForWorkspaceTool, getUsersForWorkspaceTool } from './tools/user-tools.js';