get-upcoming-iterations
Retrieve upcoming Shortcut iterations for the current user's teams to track project timelines and plan work schedules effectively.
Instructions
Get the upcoming Shortcut iterations for the current user based on their team memberships
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| teamId | No | The ID of a team to filter iterations by |
Input Schema (JSON Schema)
{
"properties": {
"teamId": {
"description": "The ID of a team to filter iterations by",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/tools/iterations.ts:214-253 (handler)Executes the tool logic: fetches upcoming iterations for a given teamId or for all teams of the current user via ShortcutClientWrapper, formats the result using base methods.async getUpcomingIterations(teamId?: string) { if (teamId) { const team = await this.client.getTeam(teamId); if (!team) throw new Error(`No team found matching id: "${teamId}"`); const result = await this.client.getUpcomingIteration([teamId]); const iterations = result.get(teamId); if (!iterations?.length) return this.toResult(`Result: No upcoming iterations found for team.`); if (iterations.length === 1) return this.toResult( "The next upcoming iteration for the team is:", await this.entityWithRelatedEntities(iterations[0], "iteration"), ); return this.toResult( "The next upcoming iterations for the team are:", await this.entitiesWithRelatedEntities(iterations, "iterations"), ); } const currentUser = await this.client.getCurrentUser(); if (!currentUser) throw new Error("Failed to retrieve current user."); const teams = await this.client.getTeams(); const teamIds = teams .filter((team) => team.member_ids.includes(currentUser.id)) .map((team) => team.id); if (!teamIds.length) throw new Error("Current user does not belong to any teams."); const resultsByTeam = await this.client.getUpcomingIteration(teamIds); const allUpcomingIterations = [...resultsByTeam.values()].flat(); if (!allUpcomingIterations.length) return this.toResult("Result: No upcoming iterations found for any of your teams."); return this.toResult( "The upcoming iterations for all your teams are:", await this.entitiesWithRelatedEntities(allUpcomingIterations, "iterations"), ); }
- src/tools/iterations.ts:89-96 (registration)Registers the MCP tool 'get-upcoming-iterations' with input schema and links to the handler method.server.tool( "get-upcoming-iterations", "Get the upcoming Shortcut iterations for the current user based on their team memberships", { teamId: z.string().optional().describe("The ID of a team to filter iterations by"), }, async ({ teamId }) => await tools.getUpcomingIterations(teamId), );
- src/tools/iterations.ts:93-94 (schema)Zod schema defining the input parameters for the tool: optional teamId string.teamId: z.string().optional().describe("The ID of a team to filter iterations by"), },