viewgate-mcp 1.0.45 → 1.0.46

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 +17 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75,8 +75,8 @@ function createMcpServer(apiKey, personalKey) {
75
75
  case "planning":
76
76
  return "planning";
77
77
  case "sync_endpoints":
78
- case "get_synced_endpoints":
79
78
  return "sync";
79
+ case "get_synced_endpoints":
80
80
  case "get_ai_resolved_tickets":
81
81
  return "idle";
82
82
  default:
@@ -89,15 +89,14 @@ function createMcpServer(apiKey, personalKey) {
89
89
  resetGuard();
90
90
  }
91
91
  const desiredFlow = getToolFlow(toolName);
92
- if (toolName === "get_ai_resolved_tickets") {
93
- if (guard.flow !== "idle") {
94
- throw new Error("TOOL_CALL_BLOCKED: tool not allowed in active flow");
95
- }
92
+ // Neutral tools (idle flow) are always allowed and don't interrupt active flows
93
+ if (desiredFlow === "idle") {
96
94
  guard.lastTool = toolName;
97
95
  guard.lastActivityAt = now;
98
96
  return;
99
97
  }
100
- if (guard.flow === "idle") {
98
+ if (guard.flow === "idle" || desiredFlow !== guard.flow) {
99
+ // Implicit flow reset if we are starting a new flow with a "start tool"
101
100
  switch (toolName) {
102
101
  case "get_ui_components":
103
102
  guard.flow = "ui_components";
@@ -123,16 +122,18 @@ function createMcpServer(apiKey, personalKey) {
123
122
  guard.step = 1;
124
123
  break;
125
124
  default:
126
- throw new Error("TOOL_CALL_BLOCKED: tool not allowed in idle");
125
+ if (guard.flow === "idle") {
126
+ throw new Error("TOOL_CALL_BLOCKED: tool not allowed in idle");
127
+ }
128
+ else {
129
+ throw new Error("TOOL_CALL_BLOCKED: tool not allowed in active flow");
130
+ }
127
131
  }
128
132
  guard.startedAt = now;
129
133
  guard.lastTool = toolName;
130
134
  guard.lastActivityAt = now;
131
135
  return;
132
136
  }
133
- if (desiredFlow !== guard.flow) {
134
- throw new Error("TOOL_CALL_BLOCKED: tool not allowed in active flow");
135
- }
136
137
  if (guard.flow === "ui_components") {
137
138
  if (toolName === "get_ui_components") {
138
139
  if (guard.step > 2)
@@ -155,18 +156,17 @@ function createMcpServer(apiKey, personalKey) {
155
156
  }
156
157
  else if (guard.flow === "annotations") {
157
158
  if (toolName === "get_annotations") {
158
- if (guard.step > 2)
159
- throw new Error("TOOL_CALL_BLOCKED: cannot restart flow at this step");
159
+ // Allow re-fetching at any time during the flow
160
160
  guard.step = 1;
161
161
  }
162
162
  else if (toolName === "mark_annotation_ready") {
163
163
  if (guard.step !== 1)
164
164
  throw new Error("TOOL_CALL_BLOCKED: unexpected step");
165
- guard.step = 2;
165
+ // Stop here and reset flow as per USER_REQUEST (MCP only reaches 'applied')
166
+ resetGuard();
166
167
  }
167
168
  else if (toolName === "mark_annotations_as_live") {
168
- if (guard.step !== 2)
169
- throw new Error("TOOL_CALL_BLOCKED: unexpected step");
169
+ // Optional step if the model decides to use it, but no longer part of the required chain
170
170
  resetGuard();
171
171
  }
172
172
  else {
@@ -175,18 +175,14 @@ function createMcpServer(apiKey, personalKey) {
175
175
  }
176
176
  else if (guard.flow === "ui_improvements") {
177
177
  if (toolName === "get_ui_improvements") {
178
- if (guard.step > 2)
179
- throw new Error("TOOL_CALL_BLOCKED: cannot restart flow at this step");
180
178
  guard.step = 1;
181
179
  }
182
180
  else if (toolName === "mark_annotation_ready") {
183
181
  if (guard.step !== 1)
184
182
  throw new Error("TOOL_CALL_BLOCKED: unexpected step");
185
- guard.step = 2;
183
+ resetGuard();
186
184
  }
187
185
  else if (toolName === "mark_annotations_as_live") {
188
- if (guard.step !== 2)
189
- throw new Error("TOOL_CALL_BLOCKED: unexpected step");
190
186
  resetGuard();
191
187
  }
192
188
  else {
@@ -216,8 +212,7 @@ function createMcpServer(apiKey, personalKey) {
216
212
  guard.step = 2;
217
213
  }
218
214
  else if (toolName === "get_synced_endpoints") {
219
- if (guard.step !== 2)
220
- throw new Error("TOOL_CALL_BLOCKED: unexpected step");
215
+ // Actually get_synced_endpoints is now neutral, but if called as part of flow, reset.
221
216
  resetGuard();
222
217
  }
223
218
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-mcp",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "main": "dist/index.js",
5
5
  "bin": {
6
6
  "viewgate-mcp": "./dist/index.js"