Skip to main content
Glama
by cristip73

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

NameRequiredDescriptionDefault
user_gidYesThe user GID to get teams for. Use 'me' to get teams for the current user.
opt_fieldsNoComma-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

  • 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.getTeamsForUser
    case "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) }], }; }
  • Core implementation of getTeamsForUser in AsanaClientWrapper class that calls the Asana TeamsApi to fetch teams for a user and handles errors
    async 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; } }
  • 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"] } };
  • Registration of all tools including getTeamsForUserTool in the exported tools array used by the MCP server
    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 ];
  • Import of the getTeamsForUserTool from user-tools.ts for registration in tool-handler.ts
    getTeamsForUserTool, getTeamsForWorkspaceTool, getUsersForWorkspaceTool } from './tools/user-tools.js';

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