@postman/postman-mcp-server 2.7.0 → 2.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.
Files changed (44) hide show
  1. package/README.md +32 -0
  2. package/dist/package.json +15 -13
  3. package/dist/src/clients/postman.js +2 -0
  4. package/dist/src/enabledResources.js +14 -9
  5. package/dist/src/index.js +29 -1
  6. package/dist/src/tools/addWorkspaceToPrivateNetwork.js +47 -0
  7. package/dist/src/tools/createCollectionRequest.js +255 -94
  8. package/dist/src/tools/createCollectionResponse.js +125 -3
  9. package/dist/src/tools/createSpec.js +16 -4
  10. package/dist/src/tools/createWorkspace.js +6 -2
  11. package/dist/src/tools/deleteWorkspace.js +1 -1
  12. package/dist/src/tools/generateCollection.js +2 -2
  13. package/dist/src/tools/getAnalyticsData.js +107 -0
  14. package/dist/src/tools/getAnalyticsMetadata.js +55 -0
  15. package/dist/src/tools/getCodeGenerationInstructions.js +12 -6
  16. package/dist/src/tools/getCollection/getCollectionMap.js +2 -2
  17. package/dist/src/tools/getWorkspace.js +1 -1
  18. package/dist/src/tools/{getAllPanAddElementRequests.js → listPrivateNetworkAddRequests.js} +9 -16
  19. package/dist/src/tools/{getAllElementsAndFolders.js → listPrivateNetworkWorkspaces.js} +27 -34
  20. package/dist/src/tools/publishDocumentation.js +1 -1
  21. package/dist/src/tools/pullCollectionChanges.js +3 -1
  22. package/dist/src/tools/putCollection.js +11 -1
  23. package/dist/src/tools/removeWorkspaceFromPrivateNetwork.js +36 -0
  24. package/dist/src/tools/resolveCommentThread.js +1 -1
  25. package/dist/src/tools/respondPrivateNetworkAddRequest.js +56 -0
  26. package/dist/src/tools/searchPostmanElementsInPrivateNetwork.js +127 -0
  27. package/dist/src/tools/{searchPostmanElements.js → searchPostmanElementsInPublicNetwork.js} +1 -1
  28. package/dist/src/tools/updateCollectionRequest.js +254 -97
  29. package/dist/src/tools/updateCollectionResponse.js +113 -0
  30. package/dist/src/tools/updateWorkspace.js +1 -1
  31. package/dist/src/tools/utils/errorTemplateRenderer.js +23 -0
  32. package/dist/src/views/errors/getCollectionFolder.404.njk +5 -0
  33. package/dist/src/views/errors/getCollectionRequest.404.njk +5 -0
  34. package/dist/src/views/errors/getCollectionResponse.404.njk +5 -0
  35. package/dist/src/views/errors/getEnvironment.404.njk +5 -0
  36. package/dist/src/views/errors/getMock.404.njk +5 -0
  37. package/dist/src/views/errors/getMonitor.404.njk +5 -0
  38. package/dist/src/views/errors/getSpec.404.njk +5 -0
  39. package/dist/src/views/errors/getWorkspace.404.njk +5 -0
  40. package/dist/src/views/getWorkspaces.njk +3 -3
  41. package/package.json +24 -24
  42. package/dist/src/tools/deletePanElementOrFolder.js +0 -41
  43. package/dist/src/tools/postPanElementOrFolder.js +0 -84
  44. package/dist/src/tools/updatePanElementOrFolder.js +0 -100
@@ -0,0 +1,127 @@
1
+ import { z } from 'zod';
2
+ import { ContentType } from '../clients/postman.js';
3
+ import { asMcpError, McpError } from './utils/toolHelpers.js';
4
+ export const method = 'searchPostmanElementsInPrivateNetwork';
5
+ export const description = `Search for API requests and collections in your organization's Private API Network—a curated repository of trusted, internal APIs shared by your team.
6
+
7
+ **What is the Private API Network?**
8
+ The Private API Network is where your organization stores vetted APIs for internal use. These are trusted team workspaces containing approved microservices, internal tools, and shared API collections.
9
+
10
+ **When to Use This Tool:**
11
+ - Finding internal/company trusted APIs (e.g., "find a trusted api for notification service", "find our payment APIs", "search for internal microservices")
12
+ - Discovering trusted APIs shared within your organization
13
+ - Looking up team-approved API collections and requests
14
+ - When the user wants to find collections in the private network (e.g., "find internal access control collections", "search for payment API collections in our network")
15
+
16
+ **Search Scope:**
17
+ - Searches only trusted internal APIs in the Private API Network
18
+ - Returns requests or collections from team workspaces published to the network
19
+
20
+ **Entity Types:**
21
+ - \`requests\`: Search for individual API requests (default)
22
+ - \`collections\`: Search for collections (unique collections extracted from request results; pagination applies to underlying requests)`;
23
+ export const parameters = z.object({
24
+ entityType: z
25
+ .enum(['requests', 'collections'])
26
+ .describe('The type of Postman element to search for. Use `requests` to search for individual API requests, or `collections` to search for collections (unique collections extracted from request results; pagination applies to underlying requests).')
27
+ .default('requests'),
28
+ q: z
29
+ .string()
30
+ .min(1)
31
+ .max(512)
32
+ .describe('The search query for API elements in the Private API Network (e.g. "invoices API", "notification service", "payment APIs").'),
33
+ nextCursor: z
34
+ .string()
35
+ .describe('The cursor to get the next set of results in the paginated response. If you pass an invalid value, the API returns empty results.')
36
+ .optional(),
37
+ limit: z
38
+ .number()
39
+ .int()
40
+ .gte(1)
41
+ .lte(10)
42
+ .describe('The max number of search results returned in the response.')
43
+ .default(10)
44
+ .optional(),
45
+ });
46
+ export const annotations = {
47
+ title: "Search for API requests and collections in your organization's Private API Network—a curated repository of trusted, internal APIs shared by your team.",
48
+ readOnlyHint: true,
49
+ destructiveHint: false,
50
+ idempotentHint: true,
51
+ };
52
+ const PRIVATE_NETWORK_FILTER = {
53
+ $and: [
54
+ {
55
+ privateNetwork: {
56
+ $eq: true,
57
+ },
58
+ },
59
+ ],
60
+ };
61
+ export async function handler(args, extra) {
62
+ try {
63
+ const query = new URLSearchParams();
64
+ if (args.limit !== undefined)
65
+ query.set('limit', String(args.limit));
66
+ if (args.nextCursor !== undefined)
67
+ query.set('nextCursor', String(args.nextCursor));
68
+ const endpoint = query.toString() ? `/search?${query.toString()}` : '/search';
69
+ const body = {
70
+ q: args.q,
71
+ elementType: 'requests',
72
+ filters: PRIVATE_NETWORK_FILTER,
73
+ };
74
+ const options = {
75
+ body: JSON.stringify(body),
76
+ contentType: ContentType.Json,
77
+ headers: extra.headers,
78
+ };
79
+ const result = await extra.client.post(endpoint, options);
80
+ if (args.entityType === 'collections') {
81
+ const collectionsMap = new Map();
82
+ const data = result?.data || [];
83
+ for (const item of data) {
84
+ if (item.collection && !collectionsMap.has(item.collection.id)) {
85
+ collectionsMap.set(item.collection.id, {
86
+ collectionId: item.collection.id,
87
+ collectionName: item.collection.name,
88
+ workspaceId: item.workspace?.id,
89
+ workspaceName: item.workspace?.name,
90
+ publisher: item.publisher?.name,
91
+ publisherVerified: item.publisher?.isVerified,
92
+ });
93
+ }
94
+ }
95
+ const collections = Array.from(collectionsMap.values());
96
+ return {
97
+ content: [
98
+ {
99
+ type: 'text',
100
+ text: JSON.stringify({
101
+ data: collections,
102
+ meta: {
103
+ nextCursor: result?.meta?.nextCursor,
104
+ collectionsCount: collections.length,
105
+ note: 'Collections extracted from request results. Pagination applies to underlying requests.',
106
+ },
107
+ }, null, 2),
108
+ },
109
+ ],
110
+ };
111
+ }
112
+ return {
113
+ content: [
114
+ {
115
+ type: 'text',
116
+ text: typeof result === 'string' ? result : JSON.stringify(result, null, 2),
117
+ },
118
+ ],
119
+ };
120
+ }
121
+ catch (e) {
122
+ if (e instanceof McpError) {
123
+ throw e;
124
+ }
125
+ throw asMcpError(e);
126
+ }
127
+ }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { asMcpError, McpError } from './utils/toolHelpers.js';
3
- export const method = 'searchPostmanElements';
3
+ export const method = 'searchPostmanElementsInPublicNetwork';
4
4
  export const description = 'Searches for Postman elements in the public network.\n\n**When to Use This Tool:**\n- When the user asks for a specific named request (e.g., "find PayPal requests", "search for Stripe API requests")\n- When the user wants to find collections (e.g., "find Stripe collections", "search for payment API collections")\n- When the user explicitly wants to search the public network\n- Do NOT use this for searching the user\'s own workspaces or collections (use getCollections or getWorkspaces instead)\n\n**Search Scope:**\n- Only searches the public network (public workspaces and collections)\n- Does not search private workspaces, team workspaces, or personal collections\n\n**Entity Types:**\n- `requests`: Search for individual API requests\n- `collections`: Search for collections (unique collections extracted from request results; pagination applies to underlying requests)\n';
5
5
  export const parameters = z.object({
6
6
  entityType: z
@@ -6,7 +6,8 @@ export const description = 'Updates a request in a collection. For a complete li
6
6
  export const parameters = z.object({
7
7
  requestId: z.string().describe("The request's ID."),
8
8
  collectionId: z.string().describe("The collection's ID."),
9
- name: z.string().describe('Name of the request. Only provided fields are updated.').optional(),
9
+ name: z.string().describe("The request's name.").optional(),
10
+ description: z.string().nullable().describe("The request's description.").optional(),
10
11
  method: z
11
12
  .enum([
12
13
  'GET',
@@ -25,58 +26,81 @@ export const parameters = z.object({
25
26
  'PROPFIND',
26
27
  'VIEW',
27
28
  ])
28
- .nullable()
29
- .describe("The request's method.")
29
+ .describe("The request's HTTP method.")
30
30
  .optional(),
31
- description: z.string().nullable().optional(),
32
- url: z.string().nullable().optional(),
31
+ url: z.string().nullable().describe("The request's URL.").optional(),
33
32
  headerData: z
34
33
  .array(z.object({
35
- key: z.string().optional(),
36
- value: z.string().optional(),
37
- description: z.string().nullable().optional(),
34
+ key: z.string().describe("The header's key.").optional(),
35
+ value: z.string().describe("The header's value.").optional(),
36
+ description: z.string().describe("The header's description.").optional(),
38
37
  }))
38
+ .describe("The request's headers.")
39
39
  .optional(),
40
40
  queryParams: z
41
41
  .array(z.object({
42
- key: z.string().optional(),
43
- value: z.string().optional(),
44
- description: z.string().nullable().optional(),
45
- enabled: z.boolean().optional(),
42
+ key: z.string().describe("The query parameter's key.").optional(),
43
+ value: z.string().describe("The query parameter's value.").optional(),
44
+ description: z.string().describe("The query parameter's description.").optional(),
45
+ enabled: z.boolean().describe('If true, the query parameter is enabled.').optional(),
46
46
  }))
47
+ .describe("The request's query parameters.")
48
+ .optional(),
49
+ dataMode: z
50
+ .enum(['raw', 'urlencoded', 'formdata', 'binary', 'graphql'])
51
+ .describe("The request body's data mode.")
47
52
  .optional(),
48
- dataMode: z.enum(['raw', 'urlencoded', 'formdata', 'binary', 'graphql']).nullable().optional(),
49
53
  data: z
50
54
  .array(z.object({
51
- key: z.string().optional(),
52
- value: z.string().optional(),
53
- description: z.string().nullable().optional(),
54
- enabled: z.boolean().optional(),
55
- type: z.enum(['text', 'file']).optional(),
56
- uuid: z.string().optional(),
55
+ key: z.string().describe("The form data's key.").optional(),
56
+ value: z.string().describe("The form data's value.").optional(),
57
+ description: z.string().describe("The form data's description.").optional(),
58
+ enabled: z.boolean().describe('If true, the form data entry is enabled.').optional(),
59
+ type: z.enum(['text', 'file']).describe("The form data's type.").optional(),
60
+ uuid: z.string().describe("The form data entry's unique identifier.").optional(),
57
61
  }))
58
62
  .nullable()
63
+ .describe("The request body's form data.")
59
64
  .optional(),
60
- rawModeData: z.string().nullable().optional(),
65
+ rawModeData: z.string().nullable().describe("The request body's raw mode data.").optional(),
61
66
  graphqlModeData: z
62
- .object({ query: z.string().optional(), variables: z.string().optional() })
67
+ .object({
68
+ query: z.string().describe('The GraphQL query.').optional(),
69
+ variables: z.string().describe('The GraphQL query variables, in JSON format.').optional(),
70
+ })
63
71
  .nullable()
72
+ .describe("The request body's GraphQL mode data.")
64
73
  .optional(),
65
74
  dataOptions: z
66
75
  .object({
67
- raw: z.record(z.string(), z.unknown()).optional(),
68
- urlencoded: z.record(z.string(), z.unknown()).optional(),
69
- params: z.record(z.string(), z.unknown()).optional(),
70
- binary: z.record(z.string(), z.unknown()).optional(),
71
- graphql: z.record(z.string(), z.unknown()).optional(),
76
+ raw: z
77
+ .object({ language: z.string().describe("The raw mode data's language type.").optional() })
78
+ .describe('Options for the `raw` data mode.')
79
+ .optional(),
80
+ urlencoded: z
81
+ .record(z.string(), z.unknown())
82
+ .describe('Options for the `urlencoded` data mode.')
83
+ .optional(),
84
+ params: z
85
+ .record(z.string(), z.unknown())
86
+ .describe('Options for the `params` data mode.')
87
+ .optional(),
88
+ binary: z
89
+ .record(z.string(), z.unknown())
90
+ .describe('Options for the `binary` data mode.')
91
+ .optional(),
92
+ graphql: z
93
+ .record(z.string(), z.unknown())
94
+ .describe('Options for the `graphql` data mode.')
95
+ .optional(),
72
96
  })
73
97
  .nullable()
98
+ .describe("Additional configurations and options set for the request body's various data modes.")
74
99
  .optional(),
75
100
  auth: z
76
101
  .object({
77
102
  type: z
78
103
  .enum([
79
- 'noauth',
80
104
  'basic',
81
105
  'bearer',
82
106
  'apikey',
@@ -89,94 +113,225 @@ export const parameters = z.object({
89
113
  'edgegrid',
90
114
  'jwt',
91
115
  'asap',
116
+ 'noauth',
92
117
  ])
93
- .optional(),
118
+ .describe('The authorization type.'),
94
119
  apikey: z
95
- .array(z.object({
96
- key: z.string().optional(),
97
- value: z.unknown().optional(),
98
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
99
- }))
120
+ .array(z
121
+ .object({
122
+ key: z.string().describe("The auth method's key value."),
123
+ value: z
124
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
125
+ .describe("The key's value.")
126
+ .optional(),
127
+ type: z
128
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
129
+ .describe("The value's type.")
130
+ .optional(),
131
+ })
132
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
133
+ .describe("The API key's authentication information.")
100
134
  .optional(),
101
- bearer: z
102
- .array(z.object({
103
- key: z.string().optional(),
104
- value: z.unknown().optional(),
105
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
106
- }))
135
+ awsv4: z
136
+ .array(z
137
+ .object({
138
+ key: z.string().describe("The auth method's key value."),
139
+ value: z
140
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
141
+ .describe("The key's value.")
142
+ .optional(),
143
+ type: z
144
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
145
+ .describe("The value's type.")
146
+ .optional(),
147
+ })
148
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
149
+ .describe('The attributes for AWS Signature authentication.')
107
150
  .optional(),
108
151
  basic: z
109
- .array(z.object({
110
- key: z.string().optional(),
111
- value: z.unknown().optional(),
112
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
113
- }))
152
+ .array(z
153
+ .object({
154
+ key: z.string().describe("The auth method's key value."),
155
+ value: z
156
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
157
+ .describe("The key's value.")
158
+ .optional(),
159
+ type: z
160
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
161
+ .describe("The value's type.")
162
+ .optional(),
163
+ })
164
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
165
+ .describe('The attributes for Basic Auth.')
114
166
  .optional(),
115
- digest: z
116
- .array(z.object({
117
- key: z.string().optional(),
118
- value: z.unknown().optional(),
119
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
120
- }))
167
+ bearer: z
168
+ .array(z
169
+ .object({
170
+ key: z.string().describe("The auth method's key value."),
171
+ value: z
172
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
173
+ .describe("The key's value.")
174
+ .optional(),
175
+ type: z
176
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
177
+ .describe("The value's type.")
178
+ .optional(),
179
+ })
180
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
181
+ .describe('The attributes for Bearer Token authentication.')
121
182
  .optional(),
122
- oauth1: z
123
- .array(z.object({
124
- key: z.string().optional(),
125
- value: z.unknown().optional(),
126
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
127
- }))
183
+ digest: z
184
+ .array(z
185
+ .object({
186
+ key: z.string().describe("The auth method's key value."),
187
+ value: z
188
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
189
+ .describe("The key's value.")
190
+ .optional(),
191
+ type: z
192
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
193
+ .describe("The value's type.")
194
+ .optional(),
195
+ })
196
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
197
+ .describe('The attributes for Digest access authentication.')
128
198
  .optional(),
129
- oauth2: z
130
- .array(z.object({
131
- key: z.string().optional(),
132
- value: z.unknown().optional(),
133
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
134
- }))
199
+ edgegrid: z
200
+ .array(z
201
+ .object({
202
+ key: z.string().describe("The auth method's key value."),
203
+ value: z
204
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
205
+ .describe("The key's value.")
206
+ .optional(),
207
+ type: z
208
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
209
+ .describe("The value's type.")
210
+ .optional(),
211
+ })
212
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
213
+ .describe('The attributes for Akamai Edgegrid authentication.')
135
214
  .optional(),
136
215
  hawk: z
137
- .array(z.object({
138
- key: z.string().optional(),
139
- value: z.unknown().optional(),
140
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
141
- }))
142
- .optional(),
143
- awsv4: z
144
- .array(z.object({
145
- key: z.string().optional(),
146
- value: z.unknown().optional(),
147
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
148
- }))
216
+ .array(z
217
+ .object({
218
+ key: z.string().describe("The auth method's key value."),
219
+ value: z
220
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
221
+ .describe("The key's value.")
222
+ .optional(),
223
+ type: z
224
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
225
+ .describe("The value's type.")
226
+ .optional(),
227
+ })
228
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
229
+ .describe('The attributes for Hawk authentication.')
149
230
  .optional(),
150
231
  ntlm: z
151
- .array(z.object({
152
- key: z.string().optional(),
153
- value: z.unknown().optional(),
154
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
155
- }))
232
+ .array(z
233
+ .object({
234
+ key: z.string().describe("The auth method's key value."),
235
+ value: z
236
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
237
+ .describe("The key's value.")
238
+ .optional(),
239
+ type: z
240
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
241
+ .describe("The value's type.")
242
+ .optional(),
243
+ })
244
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
245
+ .describe('The attributes for NTLM authentication.')
156
246
  .optional(),
157
- edgegrid: z
158
- .array(z.object({
159
- key: z.string().optional(),
160
- value: z.unknown().optional(),
161
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
162
- }))
247
+ oauth1: z
248
+ .array(z
249
+ .object({
250
+ key: z.string().describe("The auth method's key value."),
251
+ value: z
252
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
253
+ .describe("The key's value.")
254
+ .optional(),
255
+ type: z
256
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
257
+ .describe("The value's type.")
258
+ .optional(),
259
+ })
260
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
261
+ .describe('The attributes for OAuth1 authentication.')
262
+ .optional(),
263
+ oauth2: z
264
+ .array(z
265
+ .object({
266
+ key: z.string().describe("The auth method's key value."),
267
+ value: z
268
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
269
+ .describe("The key's value.")
270
+ .optional(),
271
+ type: z
272
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
273
+ .describe("The value's type.")
274
+ .optional(),
275
+ })
276
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
277
+ .describe('The attributes for OAuth2 authentication.')
163
278
  .optional(),
164
279
  jwt: z
165
- .array(z.object({
166
- key: z.string().optional(),
167
- value: z.unknown().optional(),
168
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
169
- }))
280
+ .array(z
281
+ .object({
282
+ key: z.string().describe("The auth method's key value."),
283
+ value: z
284
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
285
+ .describe("The key's value.")
286
+ .optional(),
287
+ type: z
288
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
289
+ .describe("The value's type.")
290
+ .optional(),
291
+ })
292
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
293
+ .describe('The attributes for JWT authentication.')
170
294
  .optional(),
171
295
  asap: z
172
- .array(z.object({
173
- key: z.string().optional(),
174
- value: z.unknown().optional(),
175
- type: z.enum(['string', 'boolean', 'number', 'array', 'object', 'any']).optional(),
176
- }))
296
+ .array(z
297
+ .object({
298
+ key: z.string().describe("The auth method's key value."),
299
+ value: z
300
+ .union([z.string(), z.array(z.record(z.string(), z.unknown()))])
301
+ .describe("The key's value.")
302
+ .optional(),
303
+ type: z
304
+ .enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
305
+ .describe("The value's type.")
306
+ .optional(),
307
+ })
308
+ .describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
309
+ .describe('The attributes for ASAP authentication.')
177
310
  .optional(),
178
311
  })
179
312
  .nullable()
313
+ .describe("The request's authentication information.")
314
+ .optional(),
315
+ events: z
316
+ .array(z.object({
317
+ listen: z.enum(['test', 'prerequest']).describe('The event type.').optional(),
318
+ script: z
319
+ .object({
320
+ id: z.string().describe("The script's ID.").optional(),
321
+ type: z
322
+ .string()
323
+ .describe('The type of script. For example, `text/javascript`.')
324
+ .optional(),
325
+ exec: z
326
+ .array(z.string().nullable())
327
+ .describe('A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.')
328
+ .optional(),
329
+ })
330
+ .describe('Information about the Javascript code that can be used to to perform setup or teardown operations in a response.')
331
+ .optional(),
332
+ }))
333
+ .nullable()
334
+ .describe('A list of scripts configured to run when specific events occur.')
180
335
  .optional(),
181
336
  });
182
337
  export const annotations = {
@@ -193,10 +348,10 @@ export async function handler(args, extra) {
193
348
  const bodyPayload = {};
194
349
  if (args.name !== undefined)
195
350
  bodyPayload.name = args.name;
196
- if (args.method !== undefined)
197
- bodyPayload.method = args.method;
198
351
  if (args.description !== undefined)
199
352
  bodyPayload.description = args.description;
353
+ if (args.method !== undefined)
354
+ bodyPayload.method = args.method;
200
355
  if (args.url !== undefined)
201
356
  bodyPayload.url = args.url;
202
357
  if (args.headerData !== undefined)
@@ -215,6 +370,8 @@ export async function handler(args, extra) {
215
370
  bodyPayload.dataOptions = args.dataOptions;
216
371
  if (args.auth !== undefined)
217
372
  bodyPayload.auth = args.auth;
373
+ if (args.events !== undefined)
374
+ bodyPayload.events = args.events;
218
375
  const options = {
219
376
  body: JSON.stringify(bodyPayload),
220
377
  contentType: ContentType.Json,