@postman/postman-mcp-server 2.6.1 → 2.7.1
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.
- package/README.md +236 -80
- package/dist/package.json +11 -10
- package/dist/src/enabledResources.js +9 -3
- package/dist/src/index.js +11 -0
- package/dist/src/tools/createCollection.js +1 -1
- package/dist/src/tools/createCollectionComment.js +1 -1
- package/dist/src/tools/createCollectionFolder.js +1 -1
- package/dist/src/tools/createCollectionRequest.js +257 -93
- package/dist/src/tools/createCollectionResponse.js +415 -4
- package/dist/src/tools/createEnvironment.js +1 -1
- package/dist/src/tools/createFolderComment.js +1 -1
- package/dist/src/tools/createMock.js +1 -1
- package/dist/src/tools/createMonitor.js +1 -1
- package/dist/src/tools/createRequestComment.js +1 -1
- package/dist/src/tools/createResponseComment.js +1 -1
- package/dist/src/tools/createSpec.js +17 -5
- package/dist/src/tools/createSpecFile.js +1 -1
- package/dist/src/tools/createWorkspace.js +6 -2
- package/dist/src/tools/deleteApiCollectionComment.js +1 -1
- package/dist/src/tools/deleteCollectionComment.js +1 -1
- package/dist/src/tools/deleteFolderComment.js +1 -1
- package/dist/src/tools/deleteMock.js +1 -1
- package/dist/src/tools/deletePanElementOrFolder.js +1 -1
- package/dist/src/tools/deleteRequestComment.js +1 -1
- package/dist/src/tools/deleteResponseComment.js +1 -1
- package/dist/src/tools/deleteWorkspace.js +1 -1
- package/dist/src/tools/duplicateCollection.js +1 -1
- package/dist/src/tools/generateCollection.js +3 -3
- package/dist/src/tools/getAllElementsAndFolders.js +1 -1
- package/dist/src/tools/getAuthenticatedUser.js +1 -1
- package/dist/src/tools/getCodeGenerationInstructions.js +17 -11
- package/dist/src/tools/getCollection/getCollectionMap.js +2 -2
- package/dist/src/tools/getMock.js +1 -1
- package/dist/src/tools/getMocks.js +1 -1
- package/dist/src/tools/getSourceCollectionStatus.js +1 -1
- package/dist/src/tools/getTaggedEntities.js +1 -1
- package/dist/src/tools/getWorkspace.js +1 -1
- package/dist/src/tools/getWorkspaces.js +1 -1
- package/dist/src/tools/mergeCollectionFork.js +1 -1
- package/dist/src/tools/patchCollection.js +1 -1
- package/dist/src/tools/patchEnvironment.js +1 -1
- package/dist/src/tools/postPanElementOrFolder.js +1 -1
- package/dist/src/tools/publishDocumentation.js +1 -1
- package/dist/src/tools/pullCollectionChanges.js +4 -2
- package/dist/src/tools/putCollection.js +11 -1
- package/dist/src/tools/putEnvironment.js +1 -1
- package/dist/src/tools/resolveCommentThread.js +1 -1
- package/dist/src/tools/runMonitor.js +1 -1
- package/dist/src/tools/searchPostmanElementsInPrivateNetwork.js +127 -0
- package/dist/src/tools/searchPostmanElementsInPublicNetwork.js +101 -0
- package/dist/src/tools/syncCollectionWithSpec.js +1 -1
- package/dist/src/tools/syncSpecWithCollection.js +1 -1
- package/dist/src/tools/updateApiCollectionComment.js +1 -1
- package/dist/src/tools/updateCollectionComment.js +1 -1
- package/dist/src/tools/updateCollectionFolder.js +1 -1
- package/dist/src/tools/updateCollectionRequest.js +259 -96
- package/dist/src/tools/updateCollectionResponse.js +1 -1
- package/dist/src/tools/updateFolderComment.js +1 -1
- package/dist/src/tools/updateMock.js +1 -1
- package/dist/src/tools/updatePanElementOrFolder.js +1 -1
- package/dist/src/tools/updateRequestComment.js +1 -1
- package/dist/src/tools/updateResponseComment.js +1 -1
- package/dist/src/tools/updateSpecFile.js +1 -1
- package/dist/src/tools/updateWorkspace.js +1 -1
- package/dist/src/tools/utils/templateRenderer.js +23 -0
- package/dist/src/views/getCollections.njk +12 -0
- package/dist/src/views/getWorkspaces.njk +6 -0
- package/package.json +11 -10
- package/dist/src/tools/searchPostmanElements.js +0 -69
package/dist/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { enabledResources } from './enabledResources.js';
|
|
|
10
10
|
import { PostmanAPIClient } from './clients/postman.js';
|
|
11
11
|
import { SERVER_NAME, APP_VERSION } from './constants.js';
|
|
12
12
|
import { env } from './env.js';
|
|
13
|
+
import { createTemplateRenderer } from './tools/utils/templateRenderer.js';
|
|
13
14
|
const SUPPORTED_REGIONS = {
|
|
14
15
|
us: 'https://api.postman.com',
|
|
15
16
|
eu: 'https://api.eu.postman.com',
|
|
@@ -143,6 +144,10 @@ async function run() {
|
|
|
143
144
|
serverType: useCode ? 'code' : useFull ? 'full' : 'minimal',
|
|
144
145
|
availableTools: tools.map((t) => t.method),
|
|
145
146
|
};
|
|
147
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
148
|
+
const __dirname = dirname(__filename);
|
|
149
|
+
const viewsDir = join(__dirname, './views');
|
|
150
|
+
const renderTemplate = createTemplateRenderer(viewsDir);
|
|
146
151
|
const client = new PostmanAPIClient(apiKey, undefined, serverContext);
|
|
147
152
|
log('info', 'Registering tools with McpServer');
|
|
148
153
|
for (const tool of tools) {
|
|
@@ -168,6 +173,12 @@ async function run() {
|
|
|
168
173
|
toolName,
|
|
169
174
|
durationMs,
|
|
170
175
|
});
|
|
176
|
+
if (result.content?.[0]?.type === 'text') {
|
|
177
|
+
const rendered = renderTemplate(toolName, result.content[0].text);
|
|
178
|
+
if (rendered) {
|
|
179
|
+
return { content: [{ type: 'text', text: rendered }] };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
171
182
|
return result;
|
|
172
183
|
}
|
|
173
184
|
catch (error) {
|
|
@@ -778,7 +778,7 @@ export const parameters = z.object({
|
|
|
778
778
|
.optional(),
|
|
779
779
|
});
|
|
780
780
|
export const annotations = {
|
|
781
|
-
title: 'Creates a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html)
|
|
781
|
+
title: 'Creates a collection using the [Postman Collection v2.1.0 schema format](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).',
|
|
782
782
|
readOnlyHint: false,
|
|
783
783
|
destructiveHint: false,
|
|
784
784
|
idempotentHint: false,
|
|
@@ -25,7 +25,7 @@ export const parameters = z.object({
|
|
|
25
25
|
.optional(),
|
|
26
26
|
});
|
|
27
27
|
export const annotations = {
|
|
28
|
-
title: 'Creates a comment on a collection. To create a reply on an existing comment, include the \\`threadId\\` property in the request body
|
|
28
|
+
title: 'Creates a comment on a collection. To create a reply on an existing comment, include the \\`threadId\\` property in the request body.',
|
|
29
29
|
readOnlyHint: false,
|
|
30
30
|
destructiveHint: false,
|
|
31
31
|
idempotentHint: false,
|
|
@@ -12,7 +12,7 @@ export const parameters = z.object({
|
|
|
12
12
|
folder: z.string().describe('The ID of a folder in which to create the folder.').optional(),
|
|
13
13
|
});
|
|
14
14
|
export const annotations = {
|
|
15
|
-
title: 'Creates a folder in a collection. For a complete list of properties, refer to the **Folder** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html)
|
|
15
|
+
title: 'Creates a folder in a collection. For a complete list of properties, refer to the **Folder** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).',
|
|
16
16
|
readOnlyHint: false,
|
|
17
17
|
destructiveHint: false,
|
|
18
18
|
idempotentHint: false,
|
|
@@ -10,7 +10,7 @@ export const parameters = z.object({
|
|
|
10
10
|
.describe('The folder ID in which to create the request. By default, the system will create the request at the collection level.')
|
|
11
11
|
.optional(),
|
|
12
12
|
name: z.string().describe('Name of the request').optional(),
|
|
13
|
-
description: z.string().nullable().optional(),
|
|
13
|
+
description: z.string().nullable().describe("The request's description.").optional(),
|
|
14
14
|
method: z
|
|
15
15
|
.enum([
|
|
16
16
|
'GET',
|
|
@@ -30,55 +30,87 @@ export const parameters = z.object({
|
|
|
30
30
|
'VIEW',
|
|
31
31
|
])
|
|
32
32
|
.nullable()
|
|
33
|
+
.describe("The request's HTTP method.")
|
|
33
34
|
.optional(),
|
|
34
|
-
url: z.string().nullable().optional(),
|
|
35
|
+
url: z.string().nullable().describe("The request's URL.").optional(),
|
|
35
36
|
headerData: z
|
|
36
37
|
.array(z.object({
|
|
37
|
-
key: z.string().optional(),
|
|
38
|
-
value: z.string().optional(),
|
|
39
|
-
description: z.string().nullable().optional(),
|
|
38
|
+
key: z.string().describe("The header's key.").optional(),
|
|
39
|
+
value: z.string().describe("The header's value.").optional(),
|
|
40
|
+
description: z.string().nullable().describe("The header's description.").optional(),
|
|
40
41
|
}))
|
|
42
|
+
.describe("The request's headers.")
|
|
41
43
|
.optional(),
|
|
42
44
|
queryParams: z
|
|
43
45
|
.array(z.object({
|
|
44
|
-
key: z.string().optional(),
|
|
45
|
-
value: z.string().optional(),
|
|
46
|
-
description: z
|
|
47
|
-
|
|
46
|
+
key: z.string().describe("The query parameter's key.").optional(),
|
|
47
|
+
value: z.string().describe("The query parameter's value.").optional(),
|
|
48
|
+
description: z
|
|
49
|
+
.string()
|
|
50
|
+
.nullable()
|
|
51
|
+
.describe("The query parameter's description.")
|
|
52
|
+
.optional(),
|
|
53
|
+
enabled: z.boolean().describe('If true, the query parameter is enabled.').optional(),
|
|
48
54
|
}))
|
|
55
|
+
.describe("The request's query parameters.")
|
|
56
|
+
.optional(),
|
|
57
|
+
dataMode: z
|
|
58
|
+
.enum(['raw', 'urlencoded', 'formdata', 'binary', 'graphql'])
|
|
59
|
+
.nullable()
|
|
60
|
+
.describe("The request body's data mode.")
|
|
49
61
|
.optional(),
|
|
50
|
-
dataMode: z.enum(['raw', 'urlencoded', 'formdata', 'binary', 'graphql']).nullable().optional(),
|
|
51
62
|
data: z
|
|
52
63
|
.array(z.object({
|
|
53
|
-
key: z.string().optional(),
|
|
54
|
-
value: z.string().optional(),
|
|
55
|
-
description: z.string().nullable().optional(),
|
|
56
|
-
enabled: z.boolean().optional(),
|
|
57
|
-
type: z.enum(['text', 'file']).optional(),
|
|
58
|
-
uuid: z.string().optional(),
|
|
64
|
+
key: z.string().describe("The form data's key.").optional(),
|
|
65
|
+
value: z.string().describe("The form data's value.").optional(),
|
|
66
|
+
description: z.string().nullable().describe("The form data's description.").optional(),
|
|
67
|
+
enabled: z.boolean().describe('If true, the form data entry is enabled.').optional(),
|
|
68
|
+
type: z.enum(['text', 'file']).describe("The form data's type.").optional(),
|
|
69
|
+
uuid: z.string().describe("The form data entry's unique identifier.").optional(),
|
|
59
70
|
}))
|
|
60
71
|
.nullable()
|
|
72
|
+
.describe("The request body's form data.")
|
|
61
73
|
.optional(),
|
|
62
|
-
rawModeData: z.string().nullable().optional(),
|
|
74
|
+
rawModeData: z.string().nullable().describe("The request body's raw mode data.").optional(),
|
|
63
75
|
graphqlModeData: z
|
|
64
|
-
.object({
|
|
76
|
+
.object({
|
|
77
|
+
query: z.string().describe('The GraphQL query.').optional(),
|
|
78
|
+
variables: z.string().describe('The GraphQL query variables, in JSON format.').optional(),
|
|
79
|
+
})
|
|
65
80
|
.nullable()
|
|
81
|
+
.describe("The request body's GraphQL mode data.")
|
|
66
82
|
.optional(),
|
|
67
83
|
dataOptions: z
|
|
68
84
|
.object({
|
|
69
|
-
raw: z
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
raw: z
|
|
86
|
+
.object({ language: z.string().describe("The raw mode data's language type.").optional() })
|
|
87
|
+
.catchall(z.unknown())
|
|
88
|
+
.describe('Options for the `raw` data mode.')
|
|
89
|
+
.optional(),
|
|
90
|
+
urlencoded: z
|
|
91
|
+
.record(z.string(), z.unknown())
|
|
92
|
+
.describe('Options for the `urlencoded` data mode.')
|
|
93
|
+
.optional(),
|
|
94
|
+
params: z
|
|
95
|
+
.record(z.string(), z.unknown())
|
|
96
|
+
.describe('Options for the `params` data mode.')
|
|
97
|
+
.optional(),
|
|
98
|
+
binary: z
|
|
99
|
+
.record(z.string(), z.unknown())
|
|
100
|
+
.describe('Options for the `binary` data mode.')
|
|
101
|
+
.optional(),
|
|
102
|
+
graphql: z
|
|
103
|
+
.record(z.string(), z.unknown())
|
|
104
|
+
.describe('Options for the `graphql` data mode.')
|
|
105
|
+
.optional(),
|
|
74
106
|
})
|
|
75
107
|
.nullable()
|
|
108
|
+
.describe("Additional configurations and options set for the request body's various data modes.")
|
|
76
109
|
.optional(),
|
|
77
110
|
auth: z
|
|
78
111
|
.object({
|
|
79
112
|
type: z
|
|
80
113
|
.enum([
|
|
81
|
-
'noauth',
|
|
82
114
|
'basic',
|
|
83
115
|
'bearer',
|
|
84
116
|
'apikey',
|
|
@@ -91,98 +123,228 @@ export const parameters = z.object({
|
|
|
91
123
|
'edgegrid',
|
|
92
124
|
'jwt',
|
|
93
125
|
'asap',
|
|
126
|
+
'noauth',
|
|
94
127
|
])
|
|
95
|
-
.
|
|
128
|
+
.describe('The authorization type.'),
|
|
96
129
|
apikey: z
|
|
97
|
-
.array(z
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
130
|
+
.array(z
|
|
131
|
+
.object({
|
|
132
|
+
key: z.string().describe("The auth method's key value."),
|
|
133
|
+
value: z
|
|
134
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
135
|
+
.describe("The key's value.")
|
|
136
|
+
.optional(),
|
|
137
|
+
type: z
|
|
138
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
139
|
+
.describe("The value's type.")
|
|
140
|
+
.optional(),
|
|
141
|
+
})
|
|
142
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
143
|
+
.describe("The API key's authentication information.")
|
|
102
144
|
.optional(),
|
|
103
|
-
|
|
104
|
-
.array(z
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
145
|
+
awsv4: z
|
|
146
|
+
.array(z
|
|
147
|
+
.object({
|
|
148
|
+
key: z.string().describe("The auth method's key value."),
|
|
149
|
+
value: z
|
|
150
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
151
|
+
.describe("The key's value.")
|
|
152
|
+
.optional(),
|
|
153
|
+
type: z
|
|
154
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
155
|
+
.describe("The value's type.")
|
|
156
|
+
.optional(),
|
|
157
|
+
})
|
|
158
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
159
|
+
.describe('The attributes for AWS Signature authentication.')
|
|
109
160
|
.optional(),
|
|
110
161
|
basic: z
|
|
111
|
-
.array(z
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
162
|
+
.array(z
|
|
163
|
+
.object({
|
|
164
|
+
key: z.string().describe("The auth method's key value."),
|
|
165
|
+
value: z
|
|
166
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
167
|
+
.describe("The key's value.")
|
|
168
|
+
.optional(),
|
|
169
|
+
type: z
|
|
170
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
171
|
+
.describe("The value's type.")
|
|
172
|
+
.optional(),
|
|
173
|
+
})
|
|
174
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
175
|
+
.describe('The attributes for Basic Auth.')
|
|
116
176
|
.optional(),
|
|
117
|
-
|
|
118
|
-
.array(z
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
177
|
+
bearer: z
|
|
178
|
+
.array(z
|
|
179
|
+
.object({
|
|
180
|
+
key: z.string().describe("The auth method's key value."),
|
|
181
|
+
value: z
|
|
182
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
183
|
+
.describe("The key's value.")
|
|
184
|
+
.optional(),
|
|
185
|
+
type: z
|
|
186
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
187
|
+
.describe("The value's type.")
|
|
188
|
+
.optional(),
|
|
189
|
+
})
|
|
190
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
191
|
+
.describe('The attributes for Bearer Token authentication.')
|
|
123
192
|
.optional(),
|
|
124
|
-
|
|
125
|
-
.array(z
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
193
|
+
digest: z
|
|
194
|
+
.array(z
|
|
195
|
+
.object({
|
|
196
|
+
key: z.string().describe("The auth method's key value."),
|
|
197
|
+
value: z
|
|
198
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
199
|
+
.describe("The key's value.")
|
|
200
|
+
.optional(),
|
|
201
|
+
type: z
|
|
202
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
203
|
+
.describe("The value's type.")
|
|
204
|
+
.optional(),
|
|
205
|
+
})
|
|
206
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
207
|
+
.describe('The attributes for Digest access authentication.')
|
|
130
208
|
.optional(),
|
|
131
|
-
|
|
132
|
-
.array(z
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
209
|
+
edgegrid: z
|
|
210
|
+
.array(z
|
|
211
|
+
.object({
|
|
212
|
+
key: z.string().describe("The auth method's key value."),
|
|
213
|
+
value: z
|
|
214
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
215
|
+
.describe("The key's value.")
|
|
216
|
+
.optional(),
|
|
217
|
+
type: z
|
|
218
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
219
|
+
.describe("The value's type.")
|
|
220
|
+
.optional(),
|
|
221
|
+
})
|
|
222
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
223
|
+
.describe('The attributes for Akamai Edgegrid authentication.')
|
|
137
224
|
.optional(),
|
|
138
225
|
hawk: z
|
|
139
|
-
.array(z
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
})
|
|
226
|
+
.array(z
|
|
227
|
+
.object({
|
|
228
|
+
key: z.string().describe("The auth method's key value."),
|
|
229
|
+
value: z
|
|
230
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
231
|
+
.describe("The key's value.")
|
|
232
|
+
.optional(),
|
|
233
|
+
type: z
|
|
234
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
235
|
+
.describe("The value's type.")
|
|
236
|
+
.optional(),
|
|
237
|
+
})
|
|
238
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
239
|
+
.describe('The attributes for Hawk authentication.')
|
|
151
240
|
.optional(),
|
|
152
241
|
ntlm: z
|
|
153
|
-
.array(z
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
242
|
+
.array(z
|
|
243
|
+
.object({
|
|
244
|
+
key: z.string().describe("The auth method's key value."),
|
|
245
|
+
value: z
|
|
246
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
247
|
+
.describe("The key's value.")
|
|
248
|
+
.optional(),
|
|
249
|
+
type: z
|
|
250
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
251
|
+
.describe("The value's type.")
|
|
252
|
+
.optional(),
|
|
253
|
+
})
|
|
254
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
255
|
+
.describe('The attributes for NTLM authentication.')
|
|
158
256
|
.optional(),
|
|
159
|
-
|
|
160
|
-
.array(z
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
257
|
+
oauth1: z
|
|
258
|
+
.array(z
|
|
259
|
+
.object({
|
|
260
|
+
key: z.string().describe("The auth method's key value."),
|
|
261
|
+
value: z
|
|
262
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
263
|
+
.describe("The key's value.")
|
|
264
|
+
.optional(),
|
|
265
|
+
type: z
|
|
266
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
267
|
+
.describe("The value's type.")
|
|
268
|
+
.optional(),
|
|
269
|
+
})
|
|
270
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
271
|
+
.describe('The attributes for OAuth1 authentication.')
|
|
272
|
+
.optional(),
|
|
273
|
+
oauth2: z
|
|
274
|
+
.array(z
|
|
275
|
+
.object({
|
|
276
|
+
key: z.string().describe("The auth method's key value."),
|
|
277
|
+
value: z
|
|
278
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
279
|
+
.describe("The key's value.")
|
|
280
|
+
.optional(),
|
|
281
|
+
type: z
|
|
282
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
283
|
+
.describe("The value's type.")
|
|
284
|
+
.optional(),
|
|
285
|
+
})
|
|
286
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
287
|
+
.describe('The attributes for OAuth2 authentication.')
|
|
165
288
|
.optional(),
|
|
166
289
|
jwt: z
|
|
167
|
-
.array(z
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
290
|
+
.array(z
|
|
291
|
+
.object({
|
|
292
|
+
key: z.string().describe("The auth method's key value."),
|
|
293
|
+
value: z
|
|
294
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
295
|
+
.describe("The key's value.")
|
|
296
|
+
.optional(),
|
|
297
|
+
type: z
|
|
298
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
299
|
+
.describe("The value's type.")
|
|
300
|
+
.optional(),
|
|
301
|
+
})
|
|
302
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
303
|
+
.describe('The attributes for JWT authentication.')
|
|
172
304
|
.optional(),
|
|
173
305
|
asap: z
|
|
174
|
-
.array(z
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
306
|
+
.array(z
|
|
307
|
+
.object({
|
|
308
|
+
key: z.string().describe("The auth method's key value."),
|
|
309
|
+
value: z
|
|
310
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
311
|
+
.describe("The key's value.")
|
|
312
|
+
.optional(),
|
|
313
|
+
type: z
|
|
314
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
315
|
+
.describe("The value's type.")
|
|
316
|
+
.optional(),
|
|
317
|
+
})
|
|
318
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
319
|
+
.describe('The attributes for ASAP authentication.')
|
|
179
320
|
.optional(),
|
|
180
321
|
})
|
|
181
322
|
.nullable()
|
|
323
|
+
.describe("The request's authentication information.")
|
|
324
|
+
.optional(),
|
|
325
|
+
events: z
|
|
326
|
+
.array(z.object({
|
|
327
|
+
listen: z.enum(['test', 'prerequest']).describe('The event type.'),
|
|
328
|
+
script: z
|
|
329
|
+
.object({
|
|
330
|
+
id: z.string().describe("The script's ID.").optional(),
|
|
331
|
+
type: z
|
|
332
|
+
.string()
|
|
333
|
+
.describe('The type of script. For example, `text/javascript`.')
|
|
334
|
+
.optional(),
|
|
335
|
+
exec: z
|
|
336
|
+
.array(z.string().nullable())
|
|
337
|
+
.describe('A list of script strings, where each line represents a line of code. Separate lines makes it easy to track script changes.')
|
|
338
|
+
.optional(),
|
|
339
|
+
})
|
|
340
|
+
.describe('Information about the Javascript code that can be used to to perform setup or teardown operations in a response.')
|
|
341
|
+
.optional(),
|
|
342
|
+
}))
|
|
343
|
+
.describe('A list of scripts configured to run when specific events occur.')
|
|
182
344
|
.optional(),
|
|
183
345
|
});
|
|
184
346
|
export const annotations = {
|
|
185
|
-
title: 'Creates a request in a collection. For a complete list of properties, refer to the **Request** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html)
|
|
347
|
+
title: 'Creates a request in a collection. For a complete list of properties, refer to the **Request** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).',
|
|
186
348
|
readOnlyHint: false,
|
|
187
349
|
destructiveHint: false,
|
|
188
350
|
idempotentHint: false,
|
|
@@ -219,6 +381,8 @@ export async function handler(args, extra) {
|
|
|
219
381
|
bodyPayload.dataOptions = args.dataOptions;
|
|
220
382
|
if (args.auth !== undefined)
|
|
221
383
|
bodyPayload.auth = args.auth;
|
|
384
|
+
if (args.events !== undefined)
|
|
385
|
+
bodyPayload.events = args.events;
|
|
222
386
|
const options = {
|
|
223
387
|
body: JSON.stringify(bodyPayload),
|
|
224
388
|
contentType: ContentType.Json,
|