@shortcut/mcp 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +30 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14771,16 +14771,16 @@ class ShortcutClientWrapper {
14771
14771
  return acc;
14772
14772
  if (startDate > today || endDate < today)
14773
14773
  return acc;
14774
+ if (!iteration.group_ids?.length)
14775
+ iteration.group_ids = ["none"];
14774
14776
  for (const groupId of iteration.group_ids) {
14775
- if (!teamIds.includes(groupId))
14777
+ if (groupId !== "none" && !teamIds.includes(groupId))
14776
14778
  continue;
14777
- const prevIteration = acc.get(groupId);
14778
- if (prevIteration) {
14779
- const [prevIterationEndDate] = new Date(prevIteration.end_date).toISOString().split("T");
14780
- if (endDate < prevIterationEndDate)
14781
- acc.set(groupId, iteration);
14779
+ const prevIterations = acc.get(groupId);
14780
+ if (prevIterations) {
14781
+ acc.set(groupId, prevIterations.concat([iteration]));
14782
14782
  } else
14783
- acc.set(groupId, iteration);
14783
+ acc.set(groupId, [iteration]);
14784
14784
  }
14785
14785
  return acc;
14786
14786
  }, new Map);
@@ -14801,16 +14801,16 @@ class ShortcutClientWrapper {
14801
14801
  return acc;
14802
14802
  if (startDate < today)
14803
14803
  return acc;
14804
+ if (!iteration.group_ids?.length)
14805
+ iteration.group_ids = ["none"];
14804
14806
  for (const groupId of iteration.group_ids) {
14805
- if (!teamIds.includes(groupId))
14807
+ if (groupId !== "none" && !teamIds.includes(groupId))
14806
14808
  continue;
14807
- const prevIteration = acc.get(groupId);
14808
- if (prevIteration) {
14809
- const [prevIterationEndDate] = new Date(prevIteration.end_date).toISOString().split("T");
14810
- if (endDate < prevIterationEndDate)
14811
- acc.set(groupId, iteration);
14809
+ const prevIterations = acc.get(groupId);
14810
+ if (prevIterations) {
14811
+ acc.set(groupId, prevIterations.concat([iteration]));
14812
14812
  } else
14813
- acc.set(groupId, iteration);
14813
+ acc.set(groupId, [iteration]);
14814
14814
  }
14815
14815
  return acc;
14816
14816
  }, new Map);
@@ -21669,7 +21669,7 @@ var import_client = __toESM(require_lib(), 1);
21669
21669
 
21670
21670
  // package.json
21671
21671
  var name = "@shortcut/mcp";
21672
- var version = "0.8.2";
21672
+ var version = "0.8.4";
21673
21673
 
21674
21674
  // src/tools/base.ts
21675
21675
  class BaseTools {
@@ -21810,7 +21810,7 @@ class BaseTools {
21810
21810
  const relatedEntitiesForTeams = await Promise.all(Array.from(teams.values()).map((team) => this.getRelatedEntitiesForTeam(team)));
21811
21811
  const { users, workflows } = this.mergeRelatedEntities(relatedEntitiesForTeams);
21812
21812
  return {
21813
- teams: Object.fromEntries(teams.entries().map(([id, team]) => [id, this.getSimplifiedTeam(team)]).filter(([_, team]) => !!team)),
21813
+ teams: Object.fromEntries([...teams.entries()].map(([id, team]) => [id, this.getSimplifiedTeam(team)]).filter(([_, team]) => !!team)),
21814
21814
  users,
21815
21815
  workflows
21816
21816
  };
@@ -21822,7 +21822,7 @@ class BaseTools {
21822
21822
  const usersForEpicMap = await this.client.getUserMap([
21823
21823
  ...new Set([...owner_ids || [], requested_by_id, ...follower_ids || []].filter(Boolean))
21824
21824
  ]);
21825
- const usersForEpic = Object.fromEntries(usersForEpicMap.entries().filter(([_, user]) => !!user).map(([id, user]) => [id, this.getSimplifiedMember(user)]));
21825
+ const usersForEpic = Object.fromEntries([...usersForEpicMap.entries()].filter(([_, user]) => !!user).map(([id, user]) => [id, this.getSimplifiedMember(user)]));
21826
21826
  const teams = await this.client.getTeamMap(group_id ? [group_id] : []);
21827
21827
  const team = this.getSimplifiedTeam(teams.get(group_id || ""));
21828
21828
  const { users, workflows } = await this.getRelatedEntitiesForTeam(teams.get(group_id || ""));
@@ -21847,7 +21847,7 @@ class BaseTools {
21847
21847
  const fullUsersForStory = await this.client.getUserMap([
21848
21848
  ...new Set([...owner_ids || [], requested_by_id, ...follower_ids || []].filter(Boolean))
21849
21849
  ]);
21850
- const usersForStory = Object.fromEntries(fullUsersForStory.entries().filter(([_, user]) => !!user).map(([id, user]) => [id, this.getSimplifiedMember(user)]));
21850
+ const usersForStory = Object.fromEntries([...fullUsersForStory.entries()].filter(([_, user]) => !!user).map(([id, user]) => [id, this.getSimplifiedMember(user)]));
21851
21851
  const teamsForStory = await this.client.getTeamMap(group_id ? [group_id] : []);
21852
21852
  const workflowsForStory = await this.client.getWorkflowMap(workflow_id ? [workflow_id] : []);
21853
21853
  const iteration = iteration_id ? await this.client.getIteration(iteration_id) : null;
@@ -22161,10 +22161,12 @@ class IterationTools extends BaseTools {
22161
22161
  if (!team)
22162
22162
  throw new Error(`No team found matching id: "${teamId}"`);
22163
22163
  const result = await this.client.getActiveIteration([teamId]);
22164
- const iteration = result.get(teamId);
22165
- if (!iteration)
22164
+ const iterations = result.get(teamId);
22165
+ if (!iterations?.length)
22166
22166
  return this.toResult(`Result: No active iterations found for team.`);
22167
- return this.toResult("The active iteration for the team is:", await this.entityWithRelatedEntities(iteration, "iteration"));
22167
+ if (iterations.length === 1)
22168
+ return this.toResult("The active iteration for the team is:", await this.entityWithRelatedEntities(iterations[0], "iteration"));
22169
+ return this.toResult("The active iterations for the team are:", await this.entitiesWithRelatedEntities(iterations, "iterations"));
22168
22170
  }
22169
22171
  const currentUser = await this.client.getCurrentUser();
22170
22172
  if (!currentUser)
@@ -22174,7 +22176,7 @@ class IterationTools extends BaseTools {
22174
22176
  if (!teamIds.length)
22175
22177
  throw new Error("Current user does not belong to any teams.");
22176
22178
  const resultsByTeam = await this.client.getActiveIteration(teamIds);
22177
- const allActiveIterations = [...resultsByTeam.values()];
22179
+ const allActiveIterations = [...resultsByTeam.values()].flat();
22178
22180
  if (!allActiveIterations.length)
22179
22181
  return this.toResult("Result: No active iterations found for any of your teams.");
22180
22182
  return this.toResult(`You have ${allActiveIterations.length} active iterations for your teams:`, await this.entitiesWithRelatedEntities(allActiveIterations, "iterations"));
@@ -22185,10 +22187,12 @@ class IterationTools extends BaseTools {
22185
22187
  if (!team)
22186
22188
  throw new Error(`No team found matching id: "${teamId}"`);
22187
22189
  const result = await this.client.getUpcomingIteration([teamId]);
22188
- const iteration = result.get(teamId);
22189
- if (!iteration)
22190
+ const iterations = result.get(teamId);
22191
+ if (!iterations?.length)
22190
22192
  return this.toResult(`Result: No upcoming iterations found for team.`);
22191
- return this.toResult("The next upcoming iteration for the team is:", await this.entityWithRelatedEntities(iteration, "iteration"));
22193
+ if (iterations.length === 1)
22194
+ return this.toResult("The next upcoming iteration for the team is:", await this.entityWithRelatedEntities(iterations[0], "iteration"));
22195
+ return this.toResult("The next upcoming iterations for the team are:", await this.entitiesWithRelatedEntities(iterations, "iterations"));
22192
22196
  }
22193
22197
  const currentUser = await this.client.getCurrentUser();
22194
22198
  if (!currentUser)
@@ -22198,7 +22202,7 @@ class IterationTools extends BaseTools {
22198
22202
  if (!teamIds.length)
22199
22203
  throw new Error("Current user does not belong to any teams.");
22200
22204
  const resultsByTeam = await this.client.getUpcomingIteration(teamIds);
22201
- const allUpcomingIterations = [...resultsByTeam.values()];
22205
+ const allUpcomingIterations = [...resultsByTeam.values()].flat();
22202
22206
  if (!allUpcomingIterations.length)
22203
22207
  return this.toResult("Result: No upcoming iterations found for any of your teams.");
22204
22208
  return this.toResult("The upcoming iterations for all your teams are:", await this.entitiesWithRelatedEntities(allUpcomingIterations, "iterations"));
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "modelcontextprotocol"
13
13
  ],
14
14
  "license": "MIT",
15
- "version": "0.8.2",
15
+ "version": "0.8.4",
16
16
  "type": "module",
17
17
  "main": "dist/index.js",
18
18
  "bin": {