@postman/postman-mcp-server 2.7.0 → 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 +32 -0
- package/dist/package.json +10 -10
- package/dist/src/enabledResources.js +7 -4
- package/dist/src/tools/createCollectionRequest.js +256 -92
- package/dist/src/tools/createCollectionResponse.js +414 -3
- package/dist/src/tools/createSpec.js +16 -4
- package/dist/src/tools/createWorkspace.js +5 -1
- package/dist/src/tools/generateCollection.js +2 -2
- package/dist/src/tools/getCodeGenerationInstructions.js +12 -6
- package/dist/src/tools/getCollection/getCollectionMap.js +2 -2
- package/dist/src/tools/pullCollectionChanges.js +3 -1
- package/dist/src/tools/putCollection.js +10 -0
- package/dist/src/tools/searchPostmanElementsInPrivateNetwork.js +127 -0
- package/dist/src/tools/{searchPostmanElements.js → searchPostmanElementsInPublicNetwork.js} +1 -1
- package/dist/src/tools/updateCollectionRequest.js +258 -95
- package/dist/src/views/getWorkspaces.njk +3 -3
- package/package.json +10 -10
|
@@ -5,11 +5,406 @@ export const method = 'createCollectionResponse';
|
|
|
5
5
|
export const description = 'Creates a request response in a collection. For a complete list of request body properties, refer to the **Response** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).\n\n**Note:**\n\nIt is recommended that you pass the \\`name\\` property in the request body. If you do not, the system uses a null value. As a result, this creates a response with a blank name.\n';
|
|
6
6
|
export const parameters = z.object({
|
|
7
7
|
collectionId: z.string().describe("The collection's ID."),
|
|
8
|
-
|
|
8
|
+
request: z.string().describe("The parent request's ID."),
|
|
9
9
|
name: z
|
|
10
10
|
.string()
|
|
11
11
|
.describe("The response's name. It is recommended that you pass the `name` property in the request body. If you do not, the system uses a null value. As a result, this creates a response with a blank name.")
|
|
12
12
|
.optional(),
|
|
13
|
+
originalRequest: z
|
|
14
|
+
.object({
|
|
15
|
+
url: z
|
|
16
|
+
.union([
|
|
17
|
+
z.string().nullable().describe("The request's raw URL."),
|
|
18
|
+
z.object({
|
|
19
|
+
raw: z.string().describe("The request's raw URL.").optional(),
|
|
20
|
+
protocol: z.string().describe('The request protocol.').optional(),
|
|
21
|
+
host: z.array(z.string().nullable()).describe("The host's URL.").optional(),
|
|
22
|
+
path: z.array(z.string()).describe("A list of the URL's path components.").optional(),
|
|
23
|
+
port: z
|
|
24
|
+
.string()
|
|
25
|
+
.describe("The URL's port number. An empty value indicates port `80` (http) or `443` (https).")
|
|
26
|
+
.optional(),
|
|
27
|
+
query: z
|
|
28
|
+
.array(z.object({
|
|
29
|
+
key: z.string().nullable().describe("The query parameter's key.").optional(),
|
|
30
|
+
value: z.string().nullable().describe("The key's value.").optional(),
|
|
31
|
+
disabled: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.describe("If true, the query parameter isn't sent with the request.")
|
|
34
|
+
.default(false),
|
|
35
|
+
description: z
|
|
36
|
+
.string()
|
|
37
|
+
.nullable()
|
|
38
|
+
.describe("The query parameter's description.")
|
|
39
|
+
.optional(),
|
|
40
|
+
}))
|
|
41
|
+
.describe('A list of query parameters. These are the query string parts of the URL, parsed as separate variables.')
|
|
42
|
+
.optional(),
|
|
43
|
+
}),
|
|
44
|
+
])
|
|
45
|
+
.describe('Information about the URL.')
|
|
46
|
+
.optional(),
|
|
47
|
+
auth: z
|
|
48
|
+
.object({
|
|
49
|
+
type: z
|
|
50
|
+
.enum([
|
|
51
|
+
'basic',
|
|
52
|
+
'bearer',
|
|
53
|
+
'apikey',
|
|
54
|
+
'digest',
|
|
55
|
+
'oauth1',
|
|
56
|
+
'oauth2',
|
|
57
|
+
'hawk',
|
|
58
|
+
'awsv4',
|
|
59
|
+
'ntlm',
|
|
60
|
+
'edgegrid',
|
|
61
|
+
'jwt',
|
|
62
|
+
'asap',
|
|
63
|
+
])
|
|
64
|
+
.describe('The authorization type.'),
|
|
65
|
+
apikey: z
|
|
66
|
+
.array(z
|
|
67
|
+
.object({
|
|
68
|
+
key: z.string().describe("The auth method's key value."),
|
|
69
|
+
value: z
|
|
70
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
71
|
+
.describe("The key's value.")
|
|
72
|
+
.optional(),
|
|
73
|
+
type: z
|
|
74
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
75
|
+
.describe("The value's type.")
|
|
76
|
+
.optional(),
|
|
77
|
+
})
|
|
78
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
79
|
+
.describe("The API key's authentication information.")
|
|
80
|
+
.optional(),
|
|
81
|
+
awsv4: z
|
|
82
|
+
.array(z
|
|
83
|
+
.object({
|
|
84
|
+
key: z.string().describe("The auth method's key value."),
|
|
85
|
+
value: z
|
|
86
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
87
|
+
.describe("The key's value.")
|
|
88
|
+
.optional(),
|
|
89
|
+
type: z
|
|
90
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
91
|
+
.describe("The value's type.")
|
|
92
|
+
.optional(),
|
|
93
|
+
})
|
|
94
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
95
|
+
.describe('The attributes for [AWS Signature](https://learning.postman.com/docs/sending-requests/authorization/aws-signature/) authentication.')
|
|
96
|
+
.optional(),
|
|
97
|
+
basic: z
|
|
98
|
+
.array(z
|
|
99
|
+
.object({
|
|
100
|
+
key: z.string().describe("The auth method's key value."),
|
|
101
|
+
value: z
|
|
102
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
103
|
+
.describe("The key's value.")
|
|
104
|
+
.optional(),
|
|
105
|
+
type: z
|
|
106
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
107
|
+
.describe("The value's type.")
|
|
108
|
+
.optional(),
|
|
109
|
+
})
|
|
110
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
111
|
+
.describe('The attributes for [Basic Auth](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#basic-auth).')
|
|
112
|
+
.optional(),
|
|
113
|
+
bearer: z
|
|
114
|
+
.array(z
|
|
115
|
+
.object({
|
|
116
|
+
key: z.string().describe("The auth method's key value."),
|
|
117
|
+
value: z
|
|
118
|
+
.union([z.string(), z.array(z.record(z.string(), z.unknown()))])
|
|
119
|
+
.describe("The key's value.")
|
|
120
|
+
.optional(),
|
|
121
|
+
type: z
|
|
122
|
+
.enum(['string', 'boolean', 'number', 'array', 'object', 'any'])
|
|
123
|
+
.describe("The value's type.")
|
|
124
|
+
.optional(),
|
|
125
|
+
})
|
|
126
|
+
.describe('Information about the supported Postman [authorization type](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).'))
|
|
127
|
+
.describe('The attributes for [Bearer Token](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/#bearer-token) authentication.')
|
|
128
|
+
.optional(),
|
|
129
|
+
digest: z
|
|
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 attributes for [Digest](https://learning.postman.com/docs/sending-requests/authorization/digest-auth/) access authentication.')
|
|
144
|
+
.optional(),
|
|
145
|
+
edgegrid: 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 [Akamai Edgegrid](https://learning.postman.com/docs/sending-requests/authorization/akamai-edgegrid/) authentication.')
|
|
160
|
+
.optional(),
|
|
161
|
+
hawk: z
|
|
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 [Hawk](https://learning.postman.com/docs/sending-requests/authorization/hawk-authentication/) authentication.')
|
|
176
|
+
.optional(),
|
|
177
|
+
ntlm: 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 [NTLM](https://learning.postman.com/docs/sending-requests/authorization/ntlm-authentication/) authentication.')
|
|
192
|
+
.optional(),
|
|
193
|
+
oauth1: 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 [OAuth1](https://learning.postman.com/docs/sending-requests/authorization/oauth-10/) authentication.')
|
|
208
|
+
.optional(),
|
|
209
|
+
oauth2: 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 [OAuth2](https://learning.postman.com/docs/sending-requests/authorization/oauth-20/) authentication.')
|
|
224
|
+
.optional(),
|
|
225
|
+
jwt: z
|
|
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 JWT (JSON Web Token). Includes the `payload`, `secret`, `algorithm`, `addTokenTo`, and `headerPrefix` properties.')
|
|
240
|
+
.optional(),
|
|
241
|
+
asap: z
|
|
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 ASAP (Atlassian S2S Authentication Protocol). Includes the `kid`, `aud`, `iss`, `alg`, `privateKey`, and `claims` properties.')
|
|
256
|
+
.optional(),
|
|
257
|
+
})
|
|
258
|
+
.describe('The [authorization type supported by Postman](https://learning.postman.com/docs/sending-requests/authorization/authorization-types/).')
|
|
259
|
+
.optional(),
|
|
260
|
+
method: z.string().describe("The request's standard HTTP method.").optional(),
|
|
261
|
+
description: z.string().nullable().describe("The request's description.").optional(),
|
|
262
|
+
header: z
|
|
263
|
+
.array(z
|
|
264
|
+
.object({
|
|
265
|
+
key: z
|
|
266
|
+
.string()
|
|
267
|
+
.describe("The header's key, such as `Content-Type` or `X-Custom-Header`."),
|
|
268
|
+
value: z.string().describe("The header key's value."),
|
|
269
|
+
description: z.string().nullable().describe("The header's description.").optional(),
|
|
270
|
+
})
|
|
271
|
+
.describe('Information about the header.'))
|
|
272
|
+
.describe('A list of headers.')
|
|
273
|
+
.optional(),
|
|
274
|
+
body: z
|
|
275
|
+
.object({
|
|
276
|
+
mode: z
|
|
277
|
+
.enum(['raw', 'urlencoded', 'formdata', 'file', 'graphql'])
|
|
278
|
+
.describe('The data associated with the request.')
|
|
279
|
+
.optional(),
|
|
280
|
+
raw: z
|
|
281
|
+
.string()
|
|
282
|
+
.describe('If the `mode` value is `raw`, the raw content of the request body.')
|
|
283
|
+
.optional(),
|
|
284
|
+
urlencoded: z
|
|
285
|
+
.array(z.object({
|
|
286
|
+
key: z.string().describe('The key value.'),
|
|
287
|
+
value: z.string().describe("The key's value.").optional(),
|
|
288
|
+
description: z.string().nullable().describe("The key's description.").optional(),
|
|
289
|
+
}))
|
|
290
|
+
.describe('A list of x-www-form-encoded key/value pairs.')
|
|
291
|
+
.optional(),
|
|
292
|
+
formdata: z
|
|
293
|
+
.array(z.record(z.string(), z.unknown()).and(z.union([
|
|
294
|
+
z.object({
|
|
295
|
+
key: z.string().describe('The key value.').optional(),
|
|
296
|
+
value: z.string().describe("The key's value.").optional(),
|
|
297
|
+
type: z.literal('text').describe('The `text` value.').optional(),
|
|
298
|
+
contentType: z
|
|
299
|
+
.string()
|
|
300
|
+
.describe('The form-data Content-Type header.')
|
|
301
|
+
.optional(),
|
|
302
|
+
description: z
|
|
303
|
+
.string()
|
|
304
|
+
.nullable()
|
|
305
|
+
.describe("The key's description.")
|
|
306
|
+
.optional(),
|
|
307
|
+
}),
|
|
308
|
+
z.object({
|
|
309
|
+
key: z.string().describe('The key value.').optional(),
|
|
310
|
+
src: z
|
|
311
|
+
.unknown()
|
|
312
|
+
.superRefine((x, ctx) => {
|
|
313
|
+
const schemas = [z.string().nullable(), z.array(z.string())];
|
|
314
|
+
const errors = schemas.reduce((errors, schema) => ((result) => (result.error ? [...errors, result.error] : errors))(schema.safeParse(x)), []);
|
|
315
|
+
if (schemas.length - errors.length !== 1) {
|
|
316
|
+
ctx.addIssue({
|
|
317
|
+
path: ctx.path,
|
|
318
|
+
code: 'invalid_union',
|
|
319
|
+
unionErrors: errors,
|
|
320
|
+
message: 'Invalid input: Should pass single schema',
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
.optional(),
|
|
325
|
+
type: z.literal('file').describe('The `file` value.').optional(),
|
|
326
|
+
contentType: z
|
|
327
|
+
.string()
|
|
328
|
+
.describe('The form-data Content-Type header.')
|
|
329
|
+
.optional(),
|
|
330
|
+
description: z
|
|
331
|
+
.string()
|
|
332
|
+
.nullable()
|
|
333
|
+
.describe("The key's description.")
|
|
334
|
+
.optional(),
|
|
335
|
+
}),
|
|
336
|
+
])))
|
|
337
|
+
.describe('If the `mode` value is `formdata`, then a list of form-data key/pair values.')
|
|
338
|
+
.optional(),
|
|
339
|
+
file: z
|
|
340
|
+
.object({
|
|
341
|
+
src: z
|
|
342
|
+
.string()
|
|
343
|
+
.nullable()
|
|
344
|
+
.describe('The name of the file to upload (not its path). A null value indicates that no file is selected as a part of the request body.')
|
|
345
|
+
.optional(),
|
|
346
|
+
})
|
|
347
|
+
.describe('If the `mode` value is `file`, an object containing the file request information.')
|
|
348
|
+
.optional(),
|
|
349
|
+
graphql: z
|
|
350
|
+
.object({
|
|
351
|
+
query: z.string().describe('The GraphQL query.').optional(),
|
|
352
|
+
variables: z
|
|
353
|
+
.string()
|
|
354
|
+
.nullable()
|
|
355
|
+
.describe('The GraphQL query variables, in JSON format.')
|
|
356
|
+
.optional(),
|
|
357
|
+
})
|
|
358
|
+
.describe('If the `mode` value is `graphql`, an object containing the GraphQL request information.')
|
|
359
|
+
.optional(),
|
|
360
|
+
options: z
|
|
361
|
+
.record(z.string(), z.unknown())
|
|
362
|
+
.describe('Additional configurations and options set for various modes.')
|
|
363
|
+
.optional(),
|
|
364
|
+
})
|
|
365
|
+
.describe("Information about the collection's request body.")
|
|
366
|
+
.optional(),
|
|
367
|
+
})
|
|
368
|
+
.describe('Information about the collection request.')
|
|
369
|
+
.optional(),
|
|
370
|
+
responseTime: z
|
|
371
|
+
.number()
|
|
372
|
+
.nullable()
|
|
373
|
+
.describe('The time taken by the request to complete. The unit is milliseconds.')
|
|
374
|
+
.optional(),
|
|
375
|
+
timings: z
|
|
376
|
+
.record(z.string(), z.unknown())
|
|
377
|
+
.nullable()
|
|
378
|
+
.describe('Data related to the request and response timing, in milliseconds.')
|
|
379
|
+
.optional(),
|
|
380
|
+
header: z
|
|
381
|
+
.union([
|
|
382
|
+
z.string().nullable(),
|
|
383
|
+
z
|
|
384
|
+
.array(z
|
|
385
|
+
.object({
|
|
386
|
+
key: z
|
|
387
|
+
.string()
|
|
388
|
+
.describe("The header's key, such as `Content-Type` or `X-Custom-Header`."),
|
|
389
|
+
value: z.string().describe("The header key's value."),
|
|
390
|
+
description: z.string().nullable().describe("The header's description.").optional(),
|
|
391
|
+
})
|
|
392
|
+
.describe('Information about the header.'))
|
|
393
|
+
.describe("A list of the response's headers."),
|
|
394
|
+
])
|
|
395
|
+
.optional(),
|
|
396
|
+
cookie: z
|
|
397
|
+
.array(z
|
|
398
|
+
.object({
|
|
399
|
+
name: z.string().describe("The cookie's name.").optional(),
|
|
400
|
+
value: z.string().describe("The cookie's value.").optional(),
|
|
401
|
+
})
|
|
402
|
+
.catchall(z.unknown()))
|
|
403
|
+
.describe('A list of cookies included in the response.')
|
|
404
|
+
.optional(),
|
|
405
|
+
body: z.string().nullable().describe('The raw text of the response body.').optional(),
|
|
406
|
+
status: z.string().describe("The response's HTTP status.").optional(),
|
|
407
|
+
code: z.number().int().describe("The response's HTTP status code.").optional(),
|
|
13
408
|
});
|
|
14
409
|
export const annotations = {
|
|
15
410
|
title: 'Creates a request response in a collection. For a complete list of request body properties, refer to the **Response** entry in the [Postman Collection Format documentation](https://schema.postman.com/collection/json/v2.1.0/draft-07/docs/index.html).',
|
|
@@ -21,12 +416,28 @@ export async function handler(args, extra) {
|
|
|
21
416
|
try {
|
|
22
417
|
const endpoint = `/collections/${args.collectionId}/responses`;
|
|
23
418
|
const query = new URLSearchParams();
|
|
24
|
-
if (args.
|
|
25
|
-
query.set('
|
|
419
|
+
if (args.request !== undefined)
|
|
420
|
+
query.set('request', String(args.request));
|
|
26
421
|
const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
|
|
27
422
|
const bodyPayload = {};
|
|
28
423
|
if (args.name !== undefined)
|
|
29
424
|
bodyPayload.name = args.name;
|
|
425
|
+
if (args.originalRequest !== undefined)
|
|
426
|
+
bodyPayload.originalRequest = args.originalRequest;
|
|
427
|
+
if (args.responseTime !== undefined)
|
|
428
|
+
bodyPayload.responseTime = args.responseTime;
|
|
429
|
+
if (args.timings !== undefined)
|
|
430
|
+
bodyPayload.timings = args.timings;
|
|
431
|
+
if (args.header !== undefined)
|
|
432
|
+
bodyPayload.header = args.header;
|
|
433
|
+
if (args.cookie !== undefined)
|
|
434
|
+
bodyPayload.cookie = args.cookie;
|
|
435
|
+
if (args.body !== undefined)
|
|
436
|
+
bodyPayload.body = args.body;
|
|
437
|
+
if (args.status !== undefined)
|
|
438
|
+
bodyPayload.status = args.status;
|
|
439
|
+
if (args.code !== undefined)
|
|
440
|
+
bodyPayload.code = args.code;
|
|
30
441
|
const options = {
|
|
31
442
|
body: JSON.stringify(bodyPayload),
|
|
32
443
|
contentType: ContentType.Json,
|
|
@@ -2,24 +2,36 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
3
|
import { asMcpError, McpError } from './utils/toolHelpers.js';
|
|
4
4
|
export const method = 'createSpec';
|
|
5
|
-
export const description = "Creates an API specification in Postman's [Spec Hub](https://learning.postman.com/docs/design-apis/specifications/overview/). Specifications can be single or multi-file.\n\n**Note:**\n- Postman supports OpenAPI 2.0, OpenAPI 3.0, OpenAPI 3.1,
|
|
5
|
+
export const description = "Creates an API specification in Postman's [Spec Hub](https://learning.postman.com/docs/design-apis/specifications/overview/). Specifications can be single or multi-file.\n\n**Note:**\n- Postman supports OpenAPI 2.0, OpenAPI 3.0, OpenAPI 3.1, AsyncAPI 2.0, protobuf 2 and 3, and GraphQL specifications.\n- If the file path contains a \\`/\\` (forward slash) character, then a folder is created. For example, if the path is the \\`components/schemas.json\\` value, then a \\`components\\` folder is created with the \\`schemas.json\\` file inside.\n- Multi-file specifications can only have one root file.\n- Files cannot exceed a maximum of 10 MB in size.\n";
|
|
6
6
|
export const parameters = z.object({
|
|
7
7
|
workspaceId: z.string().describe("The workspace's ID."),
|
|
8
8
|
name: z.string().describe("The specification's name."),
|
|
9
9
|
type: z
|
|
10
|
-
.enum([
|
|
10
|
+
.enum([
|
|
11
|
+
'OPENAPI:2.0',
|
|
12
|
+
'OPENAPI:3.0',
|
|
13
|
+
'OPENAPI:3.1',
|
|
14
|
+
'ASYNCAPI:2.0',
|
|
15
|
+
'PROTOBUF:2',
|
|
16
|
+
'PROTOBUF:3',
|
|
17
|
+
'GRAPHQL',
|
|
18
|
+
])
|
|
11
19
|
.describe("The specification's type."),
|
|
12
20
|
files: z
|
|
13
21
|
.array(z.union([
|
|
14
22
|
z.object({
|
|
15
|
-
path: z
|
|
23
|
+
path: z
|
|
24
|
+
.string()
|
|
25
|
+
.describe("The file's path. Accepts .json, .yaml, .proto and .graphql file types."),
|
|
16
26
|
content: z.string().describe("The file's stringified contents."),
|
|
17
27
|
type: z
|
|
18
28
|
.enum(['DEFAULT', 'ROOT'])
|
|
19
29
|
.describe('The type of file. This property is required when creating multi-file specifications:\n- `ROOT` — The file containing the full OpenAPI structure. This serves as the entry point for the API spec and references other (`DEFAULT`) spec files. Multi-file specs can only have one root file.\n- `DEFAULT` — A file referenced by the `ROOT` file.\n'),
|
|
20
30
|
}),
|
|
21
31
|
z.object({
|
|
22
|
-
path: z
|
|
32
|
+
path: z
|
|
33
|
+
.string()
|
|
34
|
+
.describe("The file's path. Accepts .json, .yaml, .proto and .graphql file types."),
|
|
23
35
|
content: z.string().describe("The file's stringified contents."),
|
|
24
36
|
}),
|
|
25
37
|
]))
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ContentType } from '../clients/postman.js';
|
|
3
3
|
import { asMcpError, McpError } from './utils/toolHelpers.js';
|
|
4
4
|
export const method = 'createWorkspace';
|
|
5
|
-
export const description = 'Creates a new [workspace](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/creating-workspaces/).\n\n**Note:**\n\n- This endpoint returns a 403 \\`Forbidden\\` response if the user does not have permission to create workspaces. [Admins and Super Admins](https://learning.postman.com/docs/collaborating-in-postman/roles-and-permissions/#team-roles) can configure workspace permissions to restrict users and/or user groups from creating workspaces or require approvals for the creation of team workspaces.\n- There are rate limits when publishing public workspaces.\n- Public team workspace names must be unique.\n
|
|
5
|
+
export const description = 'Creates a new [workspace](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/creating-workspaces/).\n\n**Note:**\n\n- This endpoint returns a 403 \\`Forbidden\\` response if the user does not have permission to create workspaces. [Admins and Super Admins](https://learning.postman.com/docs/collaborating-in-postman/roles-and-permissions/#team-roles) can configure workspace permissions to restrict users and/or user groups from creating workspaces or require approvals for the creation of team workspaces.\n- There are rate limits when publishing public workspaces.\n- Public team workspace names must be unique.\n- The \\`teamId\\` property must be passed in the request body if [Postman Organizations](https://learning.postman.com/docs/administration/onboarding-checklist) is enabled.\n';
|
|
6
6
|
export const parameters = z.object({
|
|
7
7
|
workspace: z
|
|
8
8
|
.object({
|
|
@@ -12,6 +12,10 @@ export const parameters = z.object({
|
|
|
12
12
|
.describe('The type of workspace:\n- `personal`\n- `private` — Private workspaces are available on Postman [**Professional** and **Enterprise** plans](https://www.postman.com/pricing).\n- `public`\n- `team`\n- `partner` — [Partner Workspaces](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/partner-workspaces/) are available on Postman [**Professional** and **Enterprise** plans](https://www.postman.com/pricing)).\n'),
|
|
13
13
|
description: z.string().describe("The workspace's description.").optional(),
|
|
14
14
|
about: z.string().describe('A brief summary about the workspace.').optional(),
|
|
15
|
+
teamId: z
|
|
16
|
+
.string()
|
|
17
|
+
.describe('The team ID to assign to the workspace. This property is required if Postman [Organizations](https://learning.postman.com/docs/administration/managing-your-team/overview) is enabled.')
|
|
18
|
+
.optional(),
|
|
15
19
|
})
|
|
16
20
|
.describe('Information about the workspace.')
|
|
17
21
|
.optional(),
|
|
@@ -18,8 +18,8 @@ export const parameters = z.object({
|
|
|
18
18
|
.describe('The option for setting the indentation character type.')
|
|
19
19
|
.default('Space'),
|
|
20
20
|
parametersResolution: z
|
|
21
|
-
.
|
|
22
|
-
.describe(
|
|
21
|
+
.string()
|
|
22
|
+
.describe('Generated collections use examples for parameter generation by default. Any existing collections generated using the schema parameter generation will continue to sync using their existing strategy.')
|
|
23
23
|
.default('Schema'),
|
|
24
24
|
folderStrategy: z
|
|
25
25
|
.enum(['Paths', 'Tags'])
|
|
@@ -46,13 +46,19 @@ First, locate the collection the user wants to work with. Determine whether the
|
|
|
46
46
|
|
|
47
47
|
### For Public APIs
|
|
48
48
|
|
|
49
|
-
Use \`
|
|
49
|
+
Use \`searchPostmanElementsInPublicNetwork\` to find public API collections:
|
|
50
50
|
|
|
51
|
-
- \`
|
|
51
|
+
- \`searchPostmanElementsInPublicNetwork(q, entityType: collections)\` - Search for public collections. E.g. if the user says "find the Stripe API and build a demo" then call this tool with the query "stripe" and entityType "collections". Review the collection(s) returned and select the best match. If multiple collections look viable, ask the user which one to use.
|
|
52
52
|
|
|
53
|
-
### For
|
|
53
|
+
### For Private APIs in the user's organization
|
|
54
54
|
|
|
55
|
-
Use \`
|
|
55
|
+
Use \`searchPostmanElementsInPrivateNetwork\` to find API collections in the Private API Network which is a central repository of trusted Workspaces within the organisation meant for discovery and reuse :
|
|
56
|
+
|
|
57
|
+
- \`searchPostmanElementsInPrivateNetwork(q, entityType: collections)\` - Search for API collections in the Private API Network. E.g. if the user says "find the notification API and integrate it" then call this tool with the query "notification" and entityType "collections". Review the collection(s) returned and select the best match. If multiple API requests look viable, ask the user which one to use.
|
|
58
|
+
|
|
59
|
+
### For user owned APIs
|
|
60
|
+
|
|
61
|
+
Use \`getWorkspaces\` and \`getWorkspace\` to find user's internal API collections:
|
|
56
62
|
|
|
57
63
|
- \`getWorkspaces()\` - Fetch all workspaces the user has access to. Look for a workspace with a name that matches what the user is looking for.
|
|
58
64
|
|
|
@@ -64,7 +70,7 @@ Once you've identified the target collection (from either path above):
|
|
|
64
70
|
|
|
65
71
|
- \`getCollection(collectionId)\` - Fetch the collection details by passing its uid. IMPORTANT: Do NOT pass model=minimal or model=full, omit the model parameter entirely. The response will include collection-level documentation and a recursive itemRefs array with the names and uids of all folders and requests.
|
|
66
72
|
|
|
67
|
-
**IMPORTANT:** Once you have established the collection, do NOT call
|
|
73
|
+
**IMPORTANT:** Once you have established the collection, do NOT call searchPostmanElementsInPublicNetwork or searchPostmanElementsInPrivateNetwork or getWorkspaces again to find requests. Use getCollectionRequest to explore individual requests within the collection.
|
|
68
74
|
|
|
69
75
|
## 1.2 Explore Requests and Plan
|
|
70
76
|
|
|
@@ -90,7 +96,7 @@ Once you know which requests need code generated, gather all remaining context t
|
|
|
90
96
|
|
|
91
97
|
- \`getCollectionResponse(responseId, collectionId, uid: true, populate: false)\` - Call this for response example uids returned from getCollectionRequest. Use the information for: creating response types in typed languages, adding response schema comments in untyped languages, and understanding both success and error cases.
|
|
92
98
|
|
|
93
|
-
- \`getEnvironments(workspaceId)\` - Fetch all environments for the workspace that the collection belongs to (the workspaceId was returned from
|
|
99
|
+
- \`getEnvironments(workspaceId)\` - Fetch all environments for the workspace that the collection belongs to (the workspaceId was returned from searchPostmanElementsInPublicNetwork or searchPostmanElementsInPrivateNetwork). ALWAYS pass a workspaceId. If you do not have a workspaceId, do NOT call this tool.
|
|
94
100
|
|
|
95
101
|
- \`getEnvironment(environmentId)\` - For each environment, fetch the full details to see what variables have been defined and retrieve their values.
|
|
96
102
|
|
|
@@ -2,8 +2,8 @@ import { z } from 'zod';
|
|
|
2
2
|
import { asMcpError, McpError } from '../utils/toolHelpers.js';
|
|
3
3
|
export const method = 'getCollectionMap';
|
|
4
4
|
export const description = `Get a Postman collection map with metadata and a complete recursive index of all folders and requests. Response includes collection metadata and description. Response includes itemRefs property (name and id only) instead of the full item array. After calling, present the collection summary and ask the user where they\'d like to explore next, calling getCollectionFolder and/or getCollectionRequest tools in parallel to get more data quickly.
|
|
5
|
-
Once you've called this tool, DO NOT call
|
|
6
|
-
Only use
|
|
5
|
+
Once you've called this tool, DO NOT call searchPostmanElementsInPublicNetwork to find items in or related to this collection. Instead, use the map in itemRefs.
|
|
6
|
+
Only use searchPostmanElementsInPublicNetwork to find the collection where a request may be. Then, stay in the collection and don't use the search.
|
|
7
7
|
When using the getCollectionRequest tool to look up request data, omit the populate parameter to avoid getting all response examples
|
|
8
8
|
back at once (can be very large). Instead, use the response ids from the return value and call getCollectionResponse for each one.
|
|
9
9
|
Prepend the collection's ownerId to the front of each response id when passing it to getCollectionResponse. This is the first part of the collection uid.
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { asMcpError, McpError } from './utils/toolHelpers.js';
|
|
3
3
|
export const method = 'pullCollectionChanges';
|
|
4
4
|
export const description = "Pulls the changes from a parent (source) collection into the forked collection. In the endpoint's response:\n\n- The \\`destinationId\\` is the ID of the forked collection.\n- The \\`sourceId\\` is the ID of the source collection.\n";
|
|
5
|
-
export const parameters = z.object({
|
|
5
|
+
export const parameters = z.object({
|
|
6
|
+
collectionId: z.string().describe("The forked collection's ID."),
|
|
7
|
+
});
|
|
6
8
|
export const annotations = {
|
|
7
9
|
title: "Pulls the changes from a parent (source) collection into the forked collection. In the endpoint's response:",
|
|
8
10
|
readOnlyHint: false,
|
|
@@ -545,6 +545,16 @@ export const parameters = z.object({
|
|
|
545
545
|
})
|
|
546
546
|
.describe('The [settings](https://learning.postman.com/docs/sending-requests/create-requests/request-settings/) used to alter the [Protocol Profile Behavior](https://github.com/postmanlabs/postman-runtime/blob/develop/docs/protocol-profile-behavior.md) of sending a request.')
|
|
547
547
|
.optional(),
|
|
548
|
+
createdAt: z
|
|
549
|
+
.string()
|
|
550
|
+
.datetime({ offset: true })
|
|
551
|
+
.describe('The date and time at which the collection item was created.')
|
|
552
|
+
.optional(),
|
|
553
|
+
updatedAt: z
|
|
554
|
+
.string()
|
|
555
|
+
.datetime({ offset: true })
|
|
556
|
+
.describe('The date and time at which the collection item was updated.')
|
|
557
|
+
.optional(),
|
|
548
558
|
uid: z.string().describe("The collection item's unique ID.").optional(),
|
|
549
559
|
})
|
|
550
560
|
.describe('Information about the collection request or folder.')),
|