v0-api 0.0.2 → 0.0.3

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.
@@ -0,0 +1,524 @@
1
+ import client from "../utils/fetcher.mjs";
2
+ import { chatsDeletePathParamsSchema, chatsFavoritePathParamsSchema, chatsFindQueryParamsSchema, chatsForkPathParamsSchema, chatsGetByIdPathParamsSchema, chatsGetMetadataPathParamsSchema, chatsResumePathParamsSchema, chatsSendMessagePathParamsSchema, chatsUpdatePathParamsSchema, deploymentsFindErrorsPathParamsSchema, deploymentsFindLogsPathParamsSchema, deploymentsFindLogsQueryParamsSchema, projectsAssignPathParamsSchema, projectsGetByChatIdPathParamsSchema, rateLimitsFindQueryParamsSchema, userGetBillingQueryParamsSchema } from "./schemas.mjs";
3
+ /**
4
+ * @description Create a new chat
5
+ * @summary Create Chat
6
+ * {@link /chats}
7
+ */
8
+ export async function chatsCreate({ config = {} }) {
9
+ const { client: request = client, ...requestConfig } = config;
10
+ const data = await request({
11
+ method: 'POST',
12
+ url: `/chats`,
13
+ ...requestConfig,
14
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
15
+ });
16
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
17
+ }
18
+ /**
19
+ * @description Find all chats
20
+ * @summary Find Chats
21
+ * {@link /chats}
22
+ */
23
+ export async function chatsFind({ queryParams, config = {} }) {
24
+ const { client: request = client, ...requestConfig } = config;
25
+ const data = await request({ method: 'GET', url: `/chats`, queryParams, ...requestConfig });
26
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
27
+ }
28
+ /**
29
+ * @description Initialize a new chat from files
30
+ * @summary Initialize Chat
31
+ * {@link /chats/init}
32
+ */
33
+ export async function chatsInitCreate({ config = {} }) {
34
+ const { client: request = client, ...requestConfig } = config;
35
+ const data = await request({
36
+ method: 'POST',
37
+ url: `/chats/init`,
38
+ ...requestConfig,
39
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
40
+ });
41
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
42
+ }
43
+ /**
44
+ * @description Delete a chat
45
+ * @summary Delete Chat
46
+ * {@link /chats/:chatId}
47
+ */
48
+ export async function chatsDelete({ pathParams: { chatId }, config = {} }) {
49
+ const { client: request = client, ...requestConfig } = config;
50
+ if (!chatId) {
51
+ throw new Error(`Missing required path parameter: chatId`);
52
+ }
53
+ const data = await request({ method: 'DELETE', url: `/chats/${chatId}`, ...requestConfig });
54
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
55
+ }
56
+ /**
57
+ * @description Get a chat
58
+ * @summary Get Chat
59
+ * {@link /chats/:chatId}
60
+ */
61
+ export async function chatsGetById({ pathParams: { chatId }, config = {} }) {
62
+ const { client: request = client, ...requestConfig } = config;
63
+ if (!chatId) {
64
+ throw new Error(`Missing required path parameter: chatId`);
65
+ }
66
+ const data = await request({ method: 'GET', url: `/chats/${chatId}`, ...requestConfig });
67
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
68
+ }
69
+ /**
70
+ * @description Update a chat
71
+ * @summary Update Chat
72
+ * {@link /chats/:chatId}
73
+ */
74
+ export async function chatsUpdate({ pathParams: { chatId }, config = {} }) {
75
+ const { client: request = client, ...requestConfig } = config;
76
+ if (!chatId) {
77
+ throw new Error(`Missing required path parameter: chatId`);
78
+ }
79
+ const data = await request({
80
+ method: 'PATCH',
81
+ url: `/chats/${chatId}`,
82
+ ...requestConfig,
83
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
84
+ });
85
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
86
+ }
87
+ /**
88
+ * @description Favorite a chat
89
+ * @summary Favorite Chat
90
+ * {@link /chats/:chatId/favorite}
91
+ */
92
+ export async function chatsFavorite({ pathParams: { chatId }, config = {} }) {
93
+ const { client: request = client, ...requestConfig } = config;
94
+ if (!chatId) {
95
+ throw new Error(`Missing required path parameter: chatId`);
96
+ }
97
+ const data = await request({
98
+ method: 'PUT',
99
+ url: `/chats/${chatId}/favorite`,
100
+ ...requestConfig,
101
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
102
+ });
103
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
104
+ }
105
+ /**
106
+ * @description Fork a version in a chat
107
+ * @summary Fork Chat
108
+ * {@link /chats/:chatId/fork}
109
+ */
110
+ export async function chatsFork({ pathParams: { chatId }, config = {} }) {
111
+ const { client: request = client, ...requestConfig } = config;
112
+ if (!chatId) {
113
+ throw new Error(`Missing required path parameter: chatId`);
114
+ }
115
+ const data = await request({
116
+ method: 'POST',
117
+ url: `/chats/${chatId}/fork`,
118
+ ...requestConfig,
119
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
120
+ });
121
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
122
+ }
123
+ /**
124
+ * @description Get the project for a chat
125
+ * @summary Get Project by Chat ID
126
+ * {@link /chats/:chatId/project}
127
+ */
128
+ export async function projectsGetByChatId({ pathParams: { chatId }, config = {} }) {
129
+ const { client: request = client, ...requestConfig } = config;
130
+ if (!chatId) {
131
+ throw new Error(`Missing required path parameter: chatId`);
132
+ }
133
+ const data = await request({ method: 'GET', url: `/chats/${chatId}/project`, ...requestConfig });
134
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
135
+ }
136
+ /**
137
+ * @description Create a new message in a chat
138
+ * @summary Create Message
139
+ * {@link /chats/:chatId/messages}
140
+ */
141
+ export async function chatsSendMessage({ pathParams: { chatId }, config = {} }) {
142
+ const { client: request = client, ...requestConfig } = config;
143
+ if (!chatId) {
144
+ throw new Error(`Missing required path parameter: chatId`);
145
+ }
146
+ const data = await request({
147
+ method: 'POST',
148
+ url: `/chats/${chatId}/messages`,
149
+ ...requestConfig,
150
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
151
+ });
152
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
153
+ }
154
+ /**
155
+ * @description Get the metadata for a chat
156
+ * @summary Get Chat Metadata
157
+ * {@link /chats/:chatId/metadata}
158
+ */
159
+ export async function chatsGetMetadata({ pathParams: { chatId }, config = {} }) {
160
+ const { client: request = client, ...requestConfig } = config;
161
+ if (!chatId) {
162
+ throw new Error(`Missing required path parameter: chatId`);
163
+ }
164
+ const data = await request({ method: 'GET', url: `/chats/${chatId}/metadata`, ...requestConfig });
165
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
166
+ }
167
+ /**
168
+ * @description Resume a chat message
169
+ * @summary Resume Chat Message
170
+ * {@link /chats/:chatId/messages/:messageId/resume}
171
+ */
172
+ export async function chatsResume({ pathParams: { chatId, messageId }, config = {} }) {
173
+ const { client: request = client, ...requestConfig } = config;
174
+ if (!chatId) {
175
+ throw new Error(`Missing required path parameter: chatId`);
176
+ }
177
+ if (!messageId) {
178
+ throw new Error(`Missing required path parameter: messageId`);
179
+ }
180
+ const data = await request({ method: 'POST', url: `/chats/${chatId}/messages/${messageId}/resume`, ...requestConfig });
181
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
182
+ }
183
+ /**
184
+ * @description Find logs for a deployment
185
+ * @summary Find Deployment Logs
186
+ * {@link /deployments/:deploymentId/logs}
187
+ */
188
+ export async function deploymentsFindLogs({ pathParams: { deploymentId }, queryParams, config = {} }) {
189
+ const { client: request = client, ...requestConfig } = config;
190
+ if (!deploymentId) {
191
+ throw new Error(`Missing required path parameter: deploymentId`);
192
+ }
193
+ const data = await request({ method: 'GET', url: `/deployments/${deploymentId}/logs`, queryParams, ...requestConfig });
194
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
195
+ }
196
+ /**
197
+ * @description Find errors for a deployment
198
+ * @summary Find Deployment Errors
199
+ * {@link /deployments/:deploymentId/errors}
200
+ */
201
+ export async function deploymentsFindErrors({ pathParams: { deploymentId }, config = {} }) {
202
+ const { client: request = client, ...requestConfig } = config;
203
+ if (!deploymentId) {
204
+ throw new Error(`Missing required path parameter: deploymentId`);
205
+ }
206
+ const data = await request({ method: 'GET', url: `/deployments/${deploymentId}/errors`, ...requestConfig });
207
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
208
+ }
209
+ /**
210
+ * @description Find all Vercel projects
211
+ * @summary Find Vercel Projects
212
+ * {@link /integrations/vercel/projects}
213
+ */
214
+ export async function integrationsVercelProjectsFind({ config = {} }) {
215
+ const { client: request = client, ...requestConfig } = config;
216
+ const data = await request({ method: 'GET', url: `/integrations/vercel/projects`, ...requestConfig });
217
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
218
+ }
219
+ /**
220
+ * @description Create a new Vercel project
221
+ * @summary Create Vercel Project
222
+ * {@link /integrations/vercel/projects}
223
+ */
224
+ export async function integrationsVercelProjectsCreate({ config = {} }) {
225
+ const { client: request = client, ...requestConfig } = config;
226
+ const data = await request({
227
+ method: 'POST',
228
+ url: `/integrations/vercel/projects`,
229
+ ...requestConfig,
230
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
231
+ });
232
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
233
+ }
234
+ /**
235
+ * @description Find all projects
236
+ * @summary Find Projects
237
+ * {@link /projects}
238
+ */
239
+ export async function projectsFind({ config = {} }) {
240
+ const { client: request = client, ...requestConfig } = config;
241
+ const data = await request({ method: 'GET', url: `/projects`, ...requestConfig });
242
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
243
+ }
244
+ /**
245
+ * @description Create a new project
246
+ * @summary Create Project
247
+ * {@link /projects}
248
+ */
249
+ export async function projectsCreate({ config = {} }) {
250
+ const { client: request = client, ...requestConfig } = config;
251
+ const data = await request({
252
+ method: 'POST',
253
+ url: `/projects`,
254
+ ...requestConfig,
255
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
256
+ });
257
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
258
+ }
259
+ /**
260
+ * @description Assign a project to a chat
261
+ * @summary Assign Project to Chat
262
+ * {@link /projects/:projectId/assign}
263
+ */
264
+ export async function projectsAssign({ pathParams: { projectId }, config = {} }) {
265
+ const { client: request = client, ...requestConfig } = config;
266
+ if (!projectId) {
267
+ throw new Error(`Missing required path parameter: projectId`);
268
+ }
269
+ const data = await request({
270
+ method: 'POST',
271
+ url: `/projects/${projectId}/assign`,
272
+ ...requestConfig,
273
+ headers: { 'Content-Type': 'applicationJson', ...requestConfig.headers }
274
+ });
275
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
276
+ }
277
+ /**
278
+ * @description Find the rate limit for a scope
279
+ * @summary Find Rate Limit
280
+ * {@link /rate-limits}
281
+ */
282
+ export async function rateLimitsFind({ queryParams, config = {} }) {
283
+ const { client: request = client, ...requestConfig } = config;
284
+ const data = await request({ method: 'GET', url: `/rate-limits`, queryParams, ...requestConfig });
285
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
286
+ }
287
+ /**
288
+ * @description Get the user
289
+ * @summary Get User
290
+ * {@link /user}
291
+ */
292
+ export async function userGet({ config = {} }) {
293
+ const { client: request = client, ...requestConfig } = config;
294
+ const data = await request({ method: 'GET', url: `/user`, ...requestConfig });
295
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
296
+ }
297
+ /**
298
+ * @description Get the billing for the user
299
+ * @summary Get Billing
300
+ * {@link /user/billing}
301
+ */
302
+ export async function userGetBilling({ queryParams, config = {} }) {
303
+ const { client: request = client, ...requestConfig } = config;
304
+ const data = await request({ method: 'GET', url: `/user/billing`, queryParams, ...requestConfig });
305
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
306
+ }
307
+ /**
308
+ * @description Get the plan for the user
309
+ * @summary Get Plan
310
+ * {@link /user/plan}
311
+ */
312
+ export async function userGetPlan({ config = {} }) {
313
+ const { client: request = client, ...requestConfig } = config;
314
+ const data = await request({ method: 'GET', url: `/user/plan`, ...requestConfig });
315
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
316
+ }
317
+ /**
318
+ * @description Get all scopes for the user
319
+ * @summary Get User Scopes
320
+ * {@link /user/scopes}
321
+ */
322
+ export async function userGetScopes({ config = {} }) {
323
+ const { client: request = client, ...requestConfig } = config;
324
+ const data = await request({ method: 'GET', url: `/user/scopes`, ...requestConfig });
325
+ return { content: [{ type: 'text', text: JSON.stringify(data) }] };
326
+ }
327
+ export function initMcpTools(serverLike, config) {
328
+ const server = serverLike;
329
+ server.tool('chatsCreate', 'Create a new chat', async () => {
330
+ try {
331
+ return await chatsCreate({ config });
332
+ }
333
+ catch (error) {
334
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
335
+ }
336
+ });
337
+ server.tool('chatsFind', 'Find all chats', { queryParams: chatsFindQueryParamsSchema }, async ({ queryParams }) => {
338
+ try {
339
+ return await chatsFind({ queryParams, config });
340
+ }
341
+ catch (error) {
342
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
343
+ }
344
+ });
345
+ server.tool('chatsInitCreate', 'Initialize a new chat from files', async () => {
346
+ try {
347
+ return await chatsInitCreate({ config });
348
+ }
349
+ catch (error) {
350
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
351
+ }
352
+ });
353
+ server.tool('chatsDelete', 'Delete a chat', { chatId: chatsDeletePathParamsSchema.shape.chatId }, async ({ chatId }) => {
354
+ try {
355
+ return await chatsDelete({ pathParams: { chatId }, config });
356
+ }
357
+ catch (error) {
358
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
359
+ }
360
+ });
361
+ server.tool('chatsGetById', 'Get a chat', { chatId: chatsGetByIdPathParamsSchema.shape.chatId }, async ({ chatId }) => {
362
+ try {
363
+ return await chatsGetById({ pathParams: { chatId }, config });
364
+ }
365
+ catch (error) {
366
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
367
+ }
368
+ });
369
+ server.tool('chatsUpdate', 'Update a chat', { chatId: chatsUpdatePathParamsSchema.shape.chatId }, async ({ chatId }) => {
370
+ try {
371
+ return await chatsUpdate({ pathParams: { chatId }, config });
372
+ }
373
+ catch (error) {
374
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
375
+ }
376
+ });
377
+ server.tool('chatsFavorite', 'Favorite a chat', { chatId: chatsFavoritePathParamsSchema.shape.chatId }, async ({ chatId }) => {
378
+ try {
379
+ return await chatsFavorite({ pathParams: { chatId }, config });
380
+ }
381
+ catch (error) {
382
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
383
+ }
384
+ });
385
+ server.tool('chatsFork', 'Fork a version in a chat', { chatId: chatsForkPathParamsSchema.shape.chatId }, async ({ chatId }) => {
386
+ try {
387
+ return await chatsFork({ pathParams: { chatId }, config });
388
+ }
389
+ catch (error) {
390
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
391
+ }
392
+ });
393
+ server.tool('projectsGetByChatId', 'Get the project for a chat', { chatId: projectsGetByChatIdPathParamsSchema.shape.chatId }, async ({ chatId }) => {
394
+ try {
395
+ return await projectsGetByChatId({ pathParams: { chatId }, config });
396
+ }
397
+ catch (error) {
398
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
399
+ }
400
+ });
401
+ server.tool('chatsSendMessage', 'Create a new message in a chat', { chatId: chatsSendMessagePathParamsSchema.shape.chatId }, async ({ chatId }) => {
402
+ try {
403
+ return await chatsSendMessage({ pathParams: { chatId }, config });
404
+ }
405
+ catch (error) {
406
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
407
+ }
408
+ });
409
+ server.tool('chatsGetMetadata', 'Get the metadata for a chat', { chatId: chatsGetMetadataPathParamsSchema.shape.chatId }, async ({ chatId }) => {
410
+ try {
411
+ return await chatsGetMetadata({ pathParams: { chatId }, config });
412
+ }
413
+ catch (error) {
414
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
415
+ }
416
+ });
417
+ server.tool('chatsResume', 'Resume a chat message', { chatId: chatsResumePathParamsSchema.shape.chatId, messageId: chatsResumePathParamsSchema.shape.messageId }, async ({ chatId, messageId }) => {
418
+ try {
419
+ return await chatsResume({ pathParams: { chatId, messageId }, config });
420
+ }
421
+ catch (error) {
422
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
423
+ }
424
+ });
425
+ server.tool('deploymentsFindLogs', 'Find logs for a deployment', {
426
+ deploymentId: deploymentsFindLogsPathParamsSchema.shape.deploymentId,
427
+ queryParams: deploymentsFindLogsQueryParamsSchema
428
+ }, async ({ deploymentId, queryParams }) => {
429
+ try {
430
+ return await deploymentsFindLogs({ pathParams: { deploymentId }, queryParams, config });
431
+ }
432
+ catch (error) {
433
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
434
+ }
435
+ });
436
+ server.tool('deploymentsFindErrors', 'Find errors for a deployment', { deploymentId: deploymentsFindErrorsPathParamsSchema.shape.deploymentId }, async ({ deploymentId }) => {
437
+ try {
438
+ return await deploymentsFindErrors({ pathParams: { deploymentId }, config });
439
+ }
440
+ catch (error) {
441
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
442
+ }
443
+ });
444
+ server.tool('integrationsVercelProjectsFind', 'Find all Vercel projects', async () => {
445
+ try {
446
+ return await integrationsVercelProjectsFind({ config });
447
+ }
448
+ catch (error) {
449
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
450
+ }
451
+ });
452
+ server.tool('integrationsVercelProjectsCreate', 'Create a new Vercel project', async () => {
453
+ try {
454
+ return await integrationsVercelProjectsCreate({ config });
455
+ }
456
+ catch (error) {
457
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
458
+ }
459
+ });
460
+ server.tool('projectsFind', 'Find all projects', async () => {
461
+ try {
462
+ return await projectsFind({ config });
463
+ }
464
+ catch (error) {
465
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
466
+ }
467
+ });
468
+ server.tool('projectsCreate', 'Create a new project', async () => {
469
+ try {
470
+ return await projectsCreate({ config });
471
+ }
472
+ catch (error) {
473
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
474
+ }
475
+ });
476
+ server.tool('projectsAssign', 'Assign a project to a chat', { projectId: projectsAssignPathParamsSchema.shape.projectId }, async ({ projectId }) => {
477
+ try {
478
+ return await projectsAssign({ pathParams: { projectId }, config });
479
+ }
480
+ catch (error) {
481
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
482
+ }
483
+ });
484
+ server.tool('rateLimitsFind', 'Find the rate limit for a scope', { queryParams: rateLimitsFindQueryParamsSchema }, async ({ queryParams }) => {
485
+ try {
486
+ return await rateLimitsFind({ queryParams, config });
487
+ }
488
+ catch (error) {
489
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
490
+ }
491
+ });
492
+ server.tool('userGet', 'Get the user', async () => {
493
+ try {
494
+ return await userGet({ config });
495
+ }
496
+ catch (error) {
497
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
498
+ }
499
+ });
500
+ server.tool('userGetBilling', 'Get the billing for the user', { queryParams: userGetBillingQueryParamsSchema }, async ({ queryParams }) => {
501
+ try {
502
+ return await userGetBilling({ queryParams, config });
503
+ }
504
+ catch (error) {
505
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
506
+ }
507
+ });
508
+ server.tool('userGetPlan', 'Get the plan for the user', async () => {
509
+ try {
510
+ return await userGetPlan({ config });
511
+ }
512
+ catch (error) {
513
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
514
+ }
515
+ });
516
+ server.tool('userGetScopes', 'Get all scopes for the user', async () => {
517
+ try {
518
+ return await userGetScopes({ config });
519
+ }
520
+ catch (error) {
521
+ return { isError: true, content: [{ type: 'text', text: JSON.stringify(error) }] };
522
+ }
523
+ });
524
+ }