users-get-current-teams
Retrieve a list of teams where the current user is a member within the Shortcut project management platform.
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:38-61 (handler)The handler function for the 'users-get-current-teams' tool. Fetches all teams and the current user via the ShortcutClientWrapper, filters for non-archived teams that include the current user as a member, and formats the result using base tool methods.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"), ); }
- src/tools/user.ts:15-19 (registration)Registers the 'users-get-current-teams' tool with the CustomMcpServer using addToolWithReadAccess, providing the name, description, and handler reference.server.addToolWithReadAccess( "users-get-current-teams", "Get a list of teams where the current user is a member", async () => await tools.getCurrentUserTeams(), );