get-current-user-teams
Retrieve a list of teams the current user is part of using this tool, enabling quick access to Shortcut project management data via the MCP server API.
Instructions
Get a list of teams where the current user is a member
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/user.ts:16-19 (registration)Registration of the 'users-get-current-teams' tool using server.addToolWithReadAccess, which matches the requested tool name closely."users-get-current-teams", "Get a list of teams where the current user is a member", async () => await tools.getCurrentUserTeams(), );
- src/tools/user.ts:38-61 (handler)Handler function that implements the logic to get teams the current user belongs to by filtering client's getTeams based on current user's ID.async getCurrentUserTeams() { const teams = await this.client.getTeams(); const currentUser = await this.client.getCurrentUser(); if (!currentUser) throw new Error("Failed to get current user."); const userTeams = teams.filter( (team) => !team.archived && team.member_ids.includes(currentUser.id), ); if (!userTeams.length) return this.toResult(`Current user is not a member of any teams.`); if (userTeams.length === 1) { const team = userTeams[0]; return this.toResult( `Current user is a member of team "${team.name}":`, await this.entityWithRelatedEntities(team, "team"), ); } return this.toResult( `Current user is a member of ${userTeams.length} teams:`, await this.entitiesWithRelatedEntities(userTeams, "teams"), ); }