Skip to main content
Glama

get-active-iterations

Retrieve active Shortcut iterations for your current team memberships to track ongoing project cycles and sprint progress.

Instructions

Get the active Shortcut iterations for the current user based on their team memberships

Input Schema

NameRequiredDescriptionDefault
teamIdNoThe 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

  • The handler function that executes the tool logic: fetches active iterations for a specific team or all teams the current user belongs to, using the Shortcut client API.
    async getActiveIterations(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.getActiveIteration([teamId]); const iterations = result.get(teamId); if (!iterations?.length) return this.toResult(`Result: No active iterations found for team.`); if (iterations.length === 1) return this.toResult( "The active iteration for the team is:", await this.entityWithRelatedEntities(iterations[0], "iteration"), ); return this.toResult( "The active 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.getActiveIteration(teamIds); const allActiveIterations = [...resultsByTeam.values()].flat(); if (!allActiveIterations.length) return this.toResult("Result: No active iterations found for any of your teams."); return this.toResult( `You have ${allActiveIterations.length} active iterations for your teams:`, await this.entitiesWithRelatedEntities(allActiveIterations, "iterations"), ); }
  • Registers the "get-active-iterations" tool with the MCP server, including input schema and reference to the handler method.
    server.tool( "get-active-iterations", "Get the active 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.getActiveIterations(teamId), );
  • Input schema definition using Zod for the optional teamId parameter.
    { teamId: z.string().optional().describe("The ID of a team to filter iterations by"), },

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/ampcome-mcps/shortcut-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server