@clipform/mcp-server 5.7.2 → 5.8.0

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.
@@ -27,6 +27,39 @@ declare function errorResult(message: string, meta?: Record<string, unknown>): {
27
27
  }[];
28
28
  isError: boolean;
29
29
  };
30
+ /**
31
+ * An error the caller can fix (missing/conflicting args, a broken rule),
32
+ * labelled for telemetry (#5917, see error-kind.ts). It stays `isError: true`:
33
+ * the MCP spec makes input-validation and business-logic errors tool execution
34
+ * errors so the model can see the call failed and self-correct.
35
+ */
36
+ declare function refusedResult(message: string, meta?: Record<string, unknown>): {
37
+ _meta?: Record<string, unknown> | undefined;
38
+ content: {
39
+ type: "text";
40
+ text: string;
41
+ }[];
42
+ isError: boolean;
43
+ };
44
+ /**
45
+ * True when an API failure refused the caller's request rather than broke:
46
+ * any 4xx except auth faults (401, a FORBIDDEN 403), a timeout (408) or rate
47
+ * limiting (429). A PLAN_LIMIT 403, 404, 409 or 422 is a refusal.
48
+ */
49
+ declare function isRefusedStatus(status: number, code?: string): boolean;
50
+ /** Error result for a callApi failure, labelled refused when the API refused the request. */
51
+ declare function apiErrorResult(failure: {
52
+ status: number;
53
+ code?: string;
54
+ error: string;
55
+ }, message?: string, meta?: Record<string, unknown>): {
56
+ _meta?: Record<string, unknown> | undefined;
57
+ content: {
58
+ type: "text";
59
+ text: string;
60
+ }[];
61
+ isError: boolean;
62
+ };
30
63
  /**
31
64
  * True exactly when a callApi failure is the `assertNotAnonymous` account
32
65
  * gate (apps/api/src/lib/anonymous-guard.ts) - triple-keyed on status + code
@@ -63,4 +96,4 @@ declare function structuredResult(text: string, structuredContent: Record<string
63
96
  structuredContent: Record<string, unknown>;
64
97
  };
65
98
 
66
- export { authChallengeMeta, callApi, errorResult, isAnonymousAccountRequired, recoveryHint, structuredResult, textResult };
99
+ export { apiErrorResult, authChallengeMeta, callApi, errorResult, isAnonymousAccountRequired, isRefusedStatus, recoveryHint, refusedResult, structuredResult, textResult };
@@ -1,21 +1,28 @@
1
1
  import {
2
+ apiErrorResult,
2
3
  authChallengeMeta,
3
4
  callApi,
4
5
  errorResult,
5
6
  isAnonymousAccountRequired,
7
+ isRefusedStatus,
6
8
  recoveryHint,
9
+ refusedResult,
7
10
  structuredResult,
8
11
  textResult
9
- } from "./chunk-PW7O7KZF.js";
12
+ } from "./chunk-7PJHCRSD.js";
10
13
  import "./chunk-ENVV65JX.js";
11
14
  import "./chunk-PBQ5BQWD.js";
15
+ import "./chunk-XO7XBMRY.js";
12
16
  import "./chunk-PZ5AY32C.js";
13
17
  export {
18
+ apiErrorResult,
14
19
  authChallengeMeta,
15
20
  callApi,
16
21
  errorResult,
17
22
  isAnonymousAccountRequired,
23
+ isRefusedStatus,
18
24
  recoveryHint,
25
+ refusedResult,
19
26
  structuredResult,
20
27
  textResult
21
28
  };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  FULL_CAPS,
3
3
  getSessionContext
4
- } from "./chunk-GIELHE2Y.js";
4
+ } from "./chunk-HHRUYPFP.js";
5
5
  import {
6
6
  ALL_VARIANTS,
7
7
  FORM_TYPES,
8
8
  FORM_TYPE_KEYS,
9
9
  callApi
10
- } from "./chunk-PW7O7KZF.js";
10
+ } from "./chunk-7PJHCRSD.js";
11
11
  import {
12
12
  getMcpAuth
13
13
  } from "./chunk-ENVV65JX.js";
@@ -146,4 +146,4 @@ export {
146
146
  getGuideUri,
147
147
  registerResources
148
148
  };
149
- //# sourceMappingURL=chunk-AZ2MC7BU.js.map
149
+ //# sourceMappingURL=chunk-5AODH5TC.js.map
@@ -11,6 +11,9 @@ import {
11
11
  isServerFault,
12
12
  reportError
13
13
  } from "./chunk-PBQ5BQWD.js";
14
+ import {
15
+ ERROR_KIND_META_KEY
16
+ } from "./chunk-XO7XBMRY.js";
14
17
 
15
18
  // ../config/features.js
16
19
  var FEATURES = {
@@ -4087,6 +4090,17 @@ function errorResult(message, meta) {
4087
4090
  ...meta ? { _meta: meta } : {}
4088
4091
  };
4089
4092
  }
4093
+ function refusedResult(message, meta) {
4094
+ return errorResult(message, { ...meta, [ERROR_KIND_META_KEY]: "refused" });
4095
+ }
4096
+ function isRefusedStatus(status, code) {
4097
+ if (status < 400 || status >= 500) return false;
4098
+ if (status === 408 || status === 429) return false;
4099
+ return !isAuthFault(status, code);
4100
+ }
4101
+ function apiErrorResult(failure, message = failure.error, meta) {
4102
+ return isRefusedStatus(failure.status, failure.code) ? refusedResult(message, meta) : errorResult(message, meta);
4103
+ }
4090
4104
  var PROTECTED_RESOURCE_METADATA_URL = `${BUSINESS.urls.mcp}/.well-known/oauth-protected-resource`;
4091
4105
  function escapeChallengeValue(value) {
4092
4106
  return value.replace(/[\r\n]/g, "").replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -4165,9 +4179,12 @@ export {
4165
4179
  callApi,
4166
4180
  recoveryHint,
4167
4181
  errorResult,
4182
+ refusedResult,
4183
+ isRefusedStatus,
4184
+ apiErrorResult,
4168
4185
  isAnonymousAccountRequired,
4169
4186
  authChallengeMeta,
4170
4187
  textResult,
4171
4188
  structuredResult
4172
4189
  };
4173
- //# sourceMappingURL=chunk-PW7O7KZF.js.map
4190
+ //# sourceMappingURL=chunk-7PJHCRSD.js.map