@layervai/qurl-mcp 0.4.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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/dist/client.d.ts +278 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +156 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +34 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/prompts/audit-links.d.ts +7 -0
  12. package/dist/prompts/audit-links.d.ts.map +1 -0
  13. package/dist/prompts/audit-links.js +31 -0
  14. package/dist/prompts/audit-links.js.map +1 -0
  15. package/dist/prompts/rotate-access.d.ts +18 -0
  16. package/dist/prompts/rotate-access.d.ts.map +1 -0
  17. package/dist/prompts/rotate-access.js +41 -0
  18. package/dist/prompts/rotate-access.js.map +1 -0
  19. package/dist/prompts/secure-a-service.d.ts +38 -0
  20. package/dist/prompts/secure-a-service.d.ts.map +1 -0
  21. package/dist/prompts/secure-a-service.js +141 -0
  22. package/dist/prompts/secure-a-service.js.map +1 -0
  23. package/dist/resources/_shared.d.ts +31 -0
  24. package/dist/resources/_shared.d.ts.map +1 -0
  25. package/dist/resources/_shared.js +42 -0
  26. package/dist/resources/_shared.js.map +1 -0
  27. package/dist/resources/links.d.ts +15 -0
  28. package/dist/resources/links.d.ts.map +1 -0
  29. package/dist/resources/links.js +22 -0
  30. package/dist/resources/links.js.map +1 -0
  31. package/dist/resources/usage.d.ts +15 -0
  32. package/dist/resources/usage.d.ts.map +1 -0
  33. package/dist/resources/usage.js +18 -0
  34. package/dist/resources/usage.js.map +1 -0
  35. package/dist/server.d.ts +37 -0
  36. package/dist/server.d.ts.map +1 -0
  37. package/dist/server.js +58 -0
  38. package/dist/server.js.map +1 -0
  39. package/dist/tools/_shared.d.ts +78 -0
  40. package/dist/tools/_shared.d.ts.map +1 -0
  41. package/dist/tools/_shared.js +80 -0
  42. package/dist/tools/_shared.js.map +1 -0
  43. package/dist/tools/batch-create.d.ts +426 -0
  44. package/dist/tools/batch-create.d.ts.map +1 -0
  45. package/dist/tools/batch-create.js +81 -0
  46. package/dist/tools/batch-create.js.map +1 -0
  47. package/dist/tools/create-qurl.d.ts +316 -0
  48. package/dist/tools/create-qurl.d.ts.map +1 -0
  49. package/dist/tools/create-qurl.js +106 -0
  50. package/dist/tools/create-qurl.js.map +1 -0
  51. package/dist/tools/delete-qurl.d.ts +55 -0
  52. package/dist/tools/delete-qurl.d.ts.map +1 -0
  53. package/dist/tools/delete-qurl.js +76 -0
  54. package/dist/tools/delete-qurl.js.map +1 -0
  55. package/dist/tools/extend-qurl.d.ts +238 -0
  56. package/dist/tools/extend-qurl.d.ts.map +1 -0
  57. package/dist/tools/extend-qurl.js +45 -0
  58. package/dist/tools/extend-qurl.js.map +1 -0
  59. package/dist/tools/get-qurl.d.ts +231 -0
  60. package/dist/tools/get-qurl.d.ts.map +1 -0
  61. package/dist/tools/get-qurl.js +39 -0
  62. package/dist/tools/get-qurl.js.map +1 -0
  63. package/dist/tools/list-qurls.d.ts +395 -0
  64. package/dist/tools/list-qurls.d.ts.map +1 -0
  65. package/dist/tools/list-qurls.js +72 -0
  66. package/dist/tools/list-qurls.js.map +1 -0
  67. package/dist/tools/mint-link.d.ts +384 -0
  68. package/dist/tools/mint-link.d.ts.map +1 -0
  69. package/dist/tools/mint-link.js +75 -0
  70. package/dist/tools/mint-link.js.map +1 -0
  71. package/dist/tools/output-schemas.d.ts +1261 -0
  72. package/dist/tools/output-schemas.d.ts.map +1 -0
  73. package/dist/tools/output-schemas.js +173 -0
  74. package/dist/tools/output-schemas.js.map +1 -0
  75. package/dist/tools/resolve-qurl.d.ts +72 -0
  76. package/dist/tools/resolve-qurl.d.ts.map +1 -0
  77. package/dist/tools/resolve-qurl.js +42 -0
  78. package/dist/tools/resolve-qurl.js.map +1 -0
  79. package/dist/tools/update-qurl.d.ts +330 -0
  80. package/dist/tools/update-qurl.d.ts.map +1 -0
  81. package/dist/tools/update-qurl.js +96 -0
  82. package/dist/tools/update-qurl.js.map +1 -0
  83. package/package.json +58 -0
@@ -0,0 +1,316 @@
1
+ import { z } from "zod";
2
+ import type { IQURLClient } from "../client.js";
3
+ export declare const aiAgentPolicySchema: z.ZodObject<{
4
+ block_all: z.ZodOptional<z.ZodBoolean>;
5
+ deny_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
+ allow_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ block_all?: boolean | undefined;
9
+ deny_categories?: string[] | undefined;
10
+ allow_categories?: string[] | undefined;
11
+ }, {
12
+ block_all?: boolean | undefined;
13
+ deny_categories?: string[] | undefined;
14
+ allow_categories?: string[] | undefined;
15
+ }>;
16
+ export declare const accessPolicySchema: z.ZodObject<{
17
+ ip_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18
+ ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
19
+ geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
+ geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21
+ user_agent_allow_regex: z.ZodOptional<z.ZodString>;
22
+ user_agent_deny_regex: z.ZodOptional<z.ZodString>;
23
+ ai_agent_policy: z.ZodOptional<z.ZodObject<{
24
+ block_all: z.ZodOptional<z.ZodBoolean>;
25
+ deny_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
26
+ allow_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ block_all?: boolean | undefined;
29
+ deny_categories?: string[] | undefined;
30
+ allow_categories?: string[] | undefined;
31
+ }, {
32
+ block_all?: boolean | undefined;
33
+ deny_categories?: string[] | undefined;
34
+ allow_categories?: string[] | undefined;
35
+ }>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ ip_allowlist?: string[] | undefined;
38
+ ip_denylist?: string[] | undefined;
39
+ geo_allowlist?: string[] | undefined;
40
+ geo_denylist?: string[] | undefined;
41
+ user_agent_allow_regex?: string | undefined;
42
+ user_agent_deny_regex?: string | undefined;
43
+ ai_agent_policy?: {
44
+ block_all?: boolean | undefined;
45
+ deny_categories?: string[] | undefined;
46
+ allow_categories?: string[] | undefined;
47
+ } | undefined;
48
+ }, {
49
+ ip_allowlist?: string[] | undefined;
50
+ ip_denylist?: string[] | undefined;
51
+ geo_allowlist?: string[] | undefined;
52
+ geo_denylist?: string[] | undefined;
53
+ user_agent_allow_regex?: string | undefined;
54
+ user_agent_deny_regex?: string | undefined;
55
+ ai_agent_policy?: {
56
+ block_all?: boolean | undefined;
57
+ deny_categories?: string[] | undefined;
58
+ allow_categories?: string[] | undefined;
59
+ } | undefined;
60
+ }>;
61
+ export declare const createQurlSchema: z.ZodObject<{
62
+ target_url: z.ZodString;
63
+ label: z.ZodOptional<z.ZodString>;
64
+ expires_in: z.ZodOptional<z.ZodString>;
65
+ one_time_use: z.ZodOptional<z.ZodBoolean>;
66
+ max_sessions: z.ZodOptional<z.ZodNumber>;
67
+ session_duration: z.ZodOptional<z.ZodString>;
68
+ custom_domain: z.ZodOptional<z.ZodString>;
69
+ access_policy: z.ZodOptional<z.ZodObject<{
70
+ ip_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
71
+ ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
72
+ geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
73
+ geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
74
+ user_agent_allow_regex: z.ZodOptional<z.ZodString>;
75
+ user_agent_deny_regex: z.ZodOptional<z.ZodString>;
76
+ ai_agent_policy: z.ZodOptional<z.ZodObject<{
77
+ block_all: z.ZodOptional<z.ZodBoolean>;
78
+ deny_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
79
+ allow_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ block_all?: boolean | undefined;
82
+ deny_categories?: string[] | undefined;
83
+ allow_categories?: string[] | undefined;
84
+ }, {
85
+ block_all?: boolean | undefined;
86
+ deny_categories?: string[] | undefined;
87
+ allow_categories?: string[] | undefined;
88
+ }>>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ ip_allowlist?: string[] | undefined;
91
+ ip_denylist?: string[] | undefined;
92
+ geo_allowlist?: string[] | undefined;
93
+ geo_denylist?: string[] | undefined;
94
+ user_agent_allow_regex?: string | undefined;
95
+ user_agent_deny_regex?: string | undefined;
96
+ ai_agent_policy?: {
97
+ block_all?: boolean | undefined;
98
+ deny_categories?: string[] | undefined;
99
+ allow_categories?: string[] | undefined;
100
+ } | undefined;
101
+ }, {
102
+ ip_allowlist?: string[] | undefined;
103
+ ip_denylist?: string[] | undefined;
104
+ geo_allowlist?: string[] | undefined;
105
+ geo_denylist?: string[] | undefined;
106
+ user_agent_allow_regex?: string | undefined;
107
+ user_agent_deny_regex?: string | undefined;
108
+ ai_agent_policy?: {
109
+ block_all?: boolean | undefined;
110
+ deny_categories?: string[] | undefined;
111
+ allow_categories?: string[] | undefined;
112
+ } | undefined;
113
+ }>>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ target_url: string;
116
+ label?: string | undefined;
117
+ one_time_use?: boolean | undefined;
118
+ max_sessions?: number | undefined;
119
+ session_duration?: string | undefined;
120
+ access_policy?: {
121
+ ip_allowlist?: string[] | undefined;
122
+ ip_denylist?: string[] | undefined;
123
+ geo_allowlist?: string[] | undefined;
124
+ geo_denylist?: string[] | undefined;
125
+ user_agent_allow_regex?: string | undefined;
126
+ user_agent_deny_regex?: string | undefined;
127
+ ai_agent_policy?: {
128
+ block_all?: boolean | undefined;
129
+ deny_categories?: string[] | undefined;
130
+ allow_categories?: string[] | undefined;
131
+ } | undefined;
132
+ } | undefined;
133
+ custom_domain?: string | undefined;
134
+ expires_in?: string | undefined;
135
+ }, {
136
+ target_url: string;
137
+ label?: string | undefined;
138
+ one_time_use?: boolean | undefined;
139
+ max_sessions?: number | undefined;
140
+ session_duration?: string | undefined;
141
+ access_policy?: {
142
+ ip_allowlist?: string[] | undefined;
143
+ ip_denylist?: string[] | undefined;
144
+ geo_allowlist?: string[] | undefined;
145
+ geo_denylist?: string[] | undefined;
146
+ user_agent_allow_regex?: string | undefined;
147
+ user_agent_deny_regex?: string | undefined;
148
+ ai_agent_policy?: {
149
+ block_all?: boolean | undefined;
150
+ deny_categories?: string[] | undefined;
151
+ allow_categories?: string[] | undefined;
152
+ } | undefined;
153
+ } | undefined;
154
+ custom_domain?: string | undefined;
155
+ expires_in?: string | undefined;
156
+ }>;
157
+ export declare function createQurlTool(client: IQURLClient): {
158
+ name: string;
159
+ title: string;
160
+ description: string;
161
+ inputSchema: z.ZodObject<{
162
+ target_url: z.ZodString;
163
+ label: z.ZodOptional<z.ZodString>;
164
+ expires_in: z.ZodOptional<z.ZodString>;
165
+ one_time_use: z.ZodOptional<z.ZodBoolean>;
166
+ max_sessions: z.ZodOptional<z.ZodNumber>;
167
+ session_duration: z.ZodOptional<z.ZodString>;
168
+ custom_domain: z.ZodOptional<z.ZodString>;
169
+ access_policy: z.ZodOptional<z.ZodObject<{
170
+ ip_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
171
+ ip_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
172
+ geo_allowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
173
+ geo_denylist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
174
+ user_agent_allow_regex: z.ZodOptional<z.ZodString>;
175
+ user_agent_deny_regex: z.ZodOptional<z.ZodString>;
176
+ ai_agent_policy: z.ZodOptional<z.ZodObject<{
177
+ block_all: z.ZodOptional<z.ZodBoolean>;
178
+ deny_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
179
+ allow_categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ block_all?: boolean | undefined;
182
+ deny_categories?: string[] | undefined;
183
+ allow_categories?: string[] | undefined;
184
+ }, {
185
+ block_all?: boolean | undefined;
186
+ deny_categories?: string[] | undefined;
187
+ allow_categories?: string[] | undefined;
188
+ }>>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ ip_allowlist?: string[] | undefined;
191
+ ip_denylist?: string[] | undefined;
192
+ geo_allowlist?: string[] | undefined;
193
+ geo_denylist?: string[] | undefined;
194
+ user_agent_allow_regex?: string | undefined;
195
+ user_agent_deny_regex?: string | undefined;
196
+ ai_agent_policy?: {
197
+ block_all?: boolean | undefined;
198
+ deny_categories?: string[] | undefined;
199
+ allow_categories?: string[] | undefined;
200
+ } | undefined;
201
+ }, {
202
+ ip_allowlist?: string[] | undefined;
203
+ ip_denylist?: string[] | undefined;
204
+ geo_allowlist?: string[] | undefined;
205
+ geo_denylist?: string[] | undefined;
206
+ user_agent_allow_regex?: string | undefined;
207
+ user_agent_deny_regex?: string | undefined;
208
+ ai_agent_policy?: {
209
+ block_all?: boolean | undefined;
210
+ deny_categories?: string[] | undefined;
211
+ allow_categories?: string[] | undefined;
212
+ } | undefined;
213
+ }>>;
214
+ }, "strip", z.ZodTypeAny, {
215
+ target_url: string;
216
+ label?: string | undefined;
217
+ one_time_use?: boolean | undefined;
218
+ max_sessions?: number | undefined;
219
+ session_duration?: string | undefined;
220
+ access_policy?: {
221
+ ip_allowlist?: string[] | undefined;
222
+ ip_denylist?: string[] | undefined;
223
+ geo_allowlist?: string[] | undefined;
224
+ geo_denylist?: string[] | undefined;
225
+ user_agent_allow_regex?: string | undefined;
226
+ user_agent_deny_regex?: string | undefined;
227
+ ai_agent_policy?: {
228
+ block_all?: boolean | undefined;
229
+ deny_categories?: string[] | undefined;
230
+ allow_categories?: string[] | undefined;
231
+ } | undefined;
232
+ } | undefined;
233
+ custom_domain?: string | undefined;
234
+ expires_in?: string | undefined;
235
+ }, {
236
+ target_url: string;
237
+ label?: string | undefined;
238
+ one_time_use?: boolean | undefined;
239
+ max_sessions?: number | undefined;
240
+ session_duration?: string | undefined;
241
+ access_policy?: {
242
+ ip_allowlist?: string[] | undefined;
243
+ ip_denylist?: string[] | undefined;
244
+ geo_allowlist?: string[] | undefined;
245
+ geo_denylist?: string[] | undefined;
246
+ user_agent_allow_regex?: string | undefined;
247
+ user_agent_deny_regex?: string | undefined;
248
+ ai_agent_policy?: {
249
+ block_all?: boolean | undefined;
250
+ deny_categories?: string[] | undefined;
251
+ allow_categories?: string[] | undefined;
252
+ } | undefined;
253
+ } | undefined;
254
+ custom_domain?: string | undefined;
255
+ expires_in?: string | undefined;
256
+ }>;
257
+ outputSchema: z.ZodObject<{
258
+ qurl_id: z.ZodString;
259
+ resource_id: z.ZodString;
260
+ qurl_link: z.ZodString;
261
+ qurl_site: z.ZodString;
262
+ expires_at: z.ZodString;
263
+ label: z.ZodOptional<z.ZodString>;
264
+ }, "strip", z.ZodTypeAny, {
265
+ qurl_id: string;
266
+ qurl_site: string;
267
+ expires_at: string;
268
+ resource_id: string;
269
+ qurl_link: string;
270
+ label?: string | undefined;
271
+ }, {
272
+ qurl_id: string;
273
+ qurl_site: string;
274
+ expires_at: string;
275
+ resource_id: string;
276
+ qurl_link: string;
277
+ label?: string | undefined;
278
+ }>;
279
+ annotations: {
280
+ title: string;
281
+ readOnlyHint: boolean;
282
+ destructiveHint: boolean;
283
+ idempotentHint: boolean;
284
+ openWorldHint: boolean;
285
+ };
286
+ handler: (input: {
287
+ target_url: string;
288
+ label?: string | undefined;
289
+ one_time_use?: boolean | undefined;
290
+ max_sessions?: number | undefined;
291
+ session_duration?: string | undefined;
292
+ access_policy?: {
293
+ ip_allowlist?: string[] | undefined;
294
+ ip_denylist?: string[] | undefined;
295
+ geo_allowlist?: string[] | undefined;
296
+ geo_denylist?: string[] | undefined;
297
+ user_agent_allow_regex?: string | undefined;
298
+ user_agent_deny_regex?: string | undefined;
299
+ ai_agent_policy?: {
300
+ block_all?: boolean | undefined;
301
+ deny_categories?: string[] | undefined;
302
+ allow_categories?: string[] | undefined;
303
+ } | undefined;
304
+ } | undefined;
305
+ custom_domain?: string | undefined;
306
+ expires_in?: string | undefined;
307
+ }) => Promise<{
308
+ content: Array<{
309
+ type: "text";
310
+ text: string;
311
+ }>;
312
+ structuredContent?: Record<string, unknown>;
313
+ isError?: boolean;
314
+ }>;
315
+ };
316
+ //# sourceMappingURL=create-qurl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/create-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAU9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiC3B,CAAC;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCjD"}
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ import { toStructuredContent, withMissingApiKeyHandler } from "./_shared.js";
3
+ import { createQurlOutputSchema } from "./output-schemas.js";
4
+ export const aiAgentPolicySchema = z.object({
5
+ block_all: z.boolean().optional().describe("Block all recognized AI agents"),
6
+ deny_categories: z
7
+ .array(z.string())
8
+ .optional()
9
+ .describe("AI agent categories to block (e.g., gptbot, commoncrawl)"),
10
+ allow_categories: z
11
+ .array(z.string())
12
+ .optional()
13
+ .describe("AI agent categories to permit (all others blocked)"),
14
+ });
15
+ export const accessPolicySchema = z.object({
16
+ ip_allowlist: z
17
+ .array(z.string())
18
+ .optional()
19
+ .describe("Allowed IP addresses or CIDR ranges"),
20
+ ip_denylist: z
21
+ .array(z.string())
22
+ .optional()
23
+ .describe("Denied IP addresses or CIDR ranges"),
24
+ geo_allowlist: z
25
+ .array(z.string())
26
+ .optional()
27
+ .describe("Allowed country codes (ISO 3166-1 alpha-2)"),
28
+ geo_denylist: z
29
+ .array(z.string())
30
+ .optional()
31
+ .describe("Denied country codes (ISO 3166-1 alpha-2)"),
32
+ user_agent_allow_regex: z
33
+ .string()
34
+ .optional()
35
+ .describe("Regex to allow matching user agents"),
36
+ user_agent_deny_regex: z
37
+ .string()
38
+ .optional()
39
+ .describe("Regex to deny matching user agents"),
40
+ ai_agent_policy: aiAgentPolicySchema.optional().describe("Structured AI agent access control"),
41
+ });
42
+ export const createQurlSchema = z.object({
43
+ target_url: z.string().url().describe("The URL to protect with qURL"),
44
+ label: z
45
+ .string()
46
+ .max(500)
47
+ .optional()
48
+ .describe("Human-readable label identifying who this qURL is for (max 500 chars)"),
49
+ expires_in: z
50
+ .string()
51
+ .min(1)
52
+ .optional()
53
+ .describe('Duration string (e.g., "1h", "24h", "7d")'),
54
+ one_time_use: z.boolean().optional().describe("Whether the link can only be used once"),
55
+ max_sessions: z
56
+ .number()
57
+ .int()
58
+ .min(0)
59
+ .max(1000)
60
+ .optional()
61
+ .describe("Maximum concurrent sessions (0 = unlimited, max 1000)"),
62
+ session_duration: z
63
+ .string()
64
+ .min(1)
65
+ .optional()
66
+ .describe('How long access lasts after clicking (e.g., "1h")'),
67
+ custom_domain: z
68
+ .string()
69
+ .max(253)
70
+ .optional()
71
+ .describe("Custom domain to assign to the auto-created resource (max 253 chars, must be registered/active/owned)."),
72
+ access_policy: accessPolicySchema.optional().describe("Access control policy for the qURL"),
73
+ });
74
+ export function createQurlTool(client) {
75
+ return {
76
+ name: "create_qurl",
77
+ title: "Create qURL",
78
+ description: "Create a new qURL — a policy-bound, expiring access link to a protected target URL. " +
79
+ "Use this when an agent needs to mint a fresh resource (e.g. share-once link, time-limited access). " +
80
+ "Use `mint_link` instead when you already have a resource and only need an additional access link. " +
81
+ "Use `batch_create_qurls` to create many in one call. " +
82
+ "Returns the new resource ID and a `qurl_link` that is shown ONCE and never returned by `get_qurl` or `list_qurls` — share it immediately.",
83
+ inputSchema: createQurlSchema,
84
+ outputSchema: createQurlOutputSchema,
85
+ annotations: {
86
+ title: "Create qURL",
87
+ readOnlyHint: false,
88
+ destructiveHint: false,
89
+ idempotentHint: false,
90
+ openWorldHint: true,
91
+ },
92
+ handler: withMissingApiKeyHandler(async (input) => {
93
+ const result = await client.createQURL(input);
94
+ return {
95
+ content: [
96
+ {
97
+ type: "text",
98
+ text: JSON.stringify(result.data),
99
+ },
100
+ ],
101
+ structuredContent: toStructuredContent(result.data),
102
+ };
103
+ }),
104
+ };
105
+ }
106
+ //# sourceMappingURL=create-qurl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-qurl.js","sourceRoot":"","sources":["../../src/tools/create-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;IAC5E,eAAe,EAAE,CAAC;SACf,KAA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AO,EAAE,wBAAwB,CAAC,KAAK,EAAE,KAAuC,EAAE,EAAE;YAClF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAC9C,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;qBAClC;iBACF;gBACD,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC;aACpD,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ import { type IQURLClient } from "../client.js";
3
+ export declare const deleteQurlSchema: z.ZodObject<{
4
+ resource_id: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ resource_id: string;
7
+ }, {
8
+ resource_id: string;
9
+ }>;
10
+ export declare function deleteQurlTool(client: IQURLClient): {
11
+ name: string;
12
+ title: string;
13
+ description: string;
14
+ inputSchema: z.ZodObject<{
15
+ resource_id: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ resource_id: string;
18
+ }, {
19
+ resource_id: string;
20
+ }>;
21
+ outputSchema: z.ZodObject<{
22
+ resource_id: z.ZodString;
23
+ revoked: z.ZodLiteral<true>;
24
+ was_already_revoked: z.ZodBoolean;
25
+ message: z.ZodString;
26
+ }, "strip", z.ZodTypeAny, {
27
+ revoked: true;
28
+ message: string;
29
+ resource_id: string;
30
+ was_already_revoked: boolean;
31
+ }, {
32
+ revoked: true;
33
+ message: string;
34
+ resource_id: string;
35
+ was_already_revoked: boolean;
36
+ }>;
37
+ annotations: {
38
+ title: string;
39
+ readOnlyHint: boolean;
40
+ destructiveHint: boolean;
41
+ idempotentHint: boolean;
42
+ openWorldHint: boolean;
43
+ };
44
+ handler: (input: {
45
+ resource_id: string;
46
+ }) => Promise<{
47
+ content: Array<{
48
+ type: "text";
49
+ text: string;
50
+ }>;
51
+ structuredContent?: Record<string, unknown>;
52
+ isError?: boolean;
53
+ }>;
54
+ };
55
+ //# sourceMappingURL=delete-qurl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-qurl.d.ts","sourceRoot":"","sources":["../../src/tools/delete-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,cAAc,CAAC;AAI9D,eAAO,MAAM,gBAAgB;;;;;;EAY3B,CAAC;AAEH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DjD"}
@@ -0,0 +1,76 @@
1
+ import { z } from "zod";
2
+ import { QURLAPIError } from "../client.js";
3
+ import { withMissingApiKeyHandler } from "./_shared.js";
4
+ import { deleteQurlOutputSchema } from "./output-schemas.js";
5
+ export const deleteQurlSchema = z.object({
6
+ // DELETE only accepts r_ (resource) IDs per the API spec — unlike
7
+ // get/update/extend/mint_link which also accept q_ prefixes. Reject
8
+ // non-r_ IDs at the schema boundary so agents get a clear error
9
+ // instead of a confusing API-side rejection.
10
+ resource_id: z
11
+ .string()
12
+ .min(1)
13
+ .startsWith("r_", "delete_qurl only accepts resource IDs (r_ prefix). Use update_qurl or mint_link for q_ IDs.")
14
+ .describe("The resource ID (must start with r_). delete_qurl does not accept q_ (qURL display) IDs."),
15
+ });
16
+ export function deleteQurlTool(client) {
17
+ return {
18
+ name: "delete_qurl",
19
+ title: "Delete qURL",
20
+ description: "Permanently revoke a qURL — the link and every access token under it stop working immediately. " +
21
+ "**This action is irreversible.** Use this when you want to cut off access entirely (compromised link, departed user, end-of-engagement). " +
22
+ "Use `update_qurl` instead when you only need to shorten/extend the expiration, retag, or rename — those preserve the existing access tokens. " +
23
+ "Use `extend_qurl` when you only need to push the expiration out. " +
24
+ "**Idempotent:** re-deletes return success even if the resource was already revoked or never existed — verify with `get_qurl` first if the ID came from user input, or branch on the `was_already_revoked` flag in the response to distinguish the two cases. " +
25
+ "Returns a confirmation payload. By default the resource is excluded from `list_qurls`; pass `status: \"revoked\"` to see it.",
26
+ inputSchema: deleteQurlSchema,
27
+ outputSchema: deleteQurlOutputSchema,
28
+ annotations: {
29
+ title: "Delete qURL",
30
+ readOnlyHint: false,
31
+ destructiveHint: true,
32
+ idempotentHint: true,
33
+ openWorldHint: true,
34
+ },
35
+ handler: withMissingApiKeyHandler(async (input) => {
36
+ let wasAlreadyRevoked = false;
37
+ try {
38
+ await client.deleteQURL(input.resource_id);
39
+ }
40
+ catch (err) {
41
+ // Re-delete of an already-revoked (or never-existed) resource:
42
+ // the API returns 404, but the agent's intent ("this resource
43
+ // should not be live") is already satisfied. Swallow the throw
44
+ // so the tool is genuinely idempotent, but expose
45
+ // `was_already_revoked: true` in the payload so defensive
46
+ // agents can branch when they care.
47
+ //
48
+ // Intentionally checks status only, not `code`. A 404 with a
49
+ // non-JSON body (e.g. an HTML error page from a proxy in front
50
+ // of the API) lands here as `code: "parse_error"` — the
51
+ // resource still isn't live, so treating it as already-revoked
52
+ // is the right behavior; defensive agents see that via the
53
+ // `was_already_revoked` flag.
54
+ if (!(err instanceof QURLAPIError) || err.statusCode !== 404)
55
+ throw err;
56
+ wasAlreadyRevoked = true;
57
+ }
58
+ const payload = {
59
+ resource_id: input.resource_id,
60
+ revoked: true,
61
+ was_already_revoked: wasAlreadyRevoked,
62
+ message: `qURL ${input.resource_id} is revoked.`,
63
+ };
64
+ return {
65
+ content: [
66
+ {
67
+ type: "text",
68
+ text: payload.message,
69
+ },
70
+ ],
71
+ structuredContent: payload,
72
+ };
73
+ }),
74
+ };
75
+ }
76
+ //# sourceMappingURL=delete-qurl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-qurl.js","sourceRoot":"","sources":["../../src/tools/delete-qurl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM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