Open History to see the last commit
1import { toolDefinition } from '@tanstack/ai'
2import { z } from 'zod'
3
4// Sample add-ons data
5export const availableAddOns = [
6 {
7 id: 'clerk',
8 name: 'Clerk Authentication',
9 description:
10 'Complete user management and authentication solution with social logins, MFA, and session management.',
11 type: 'authentication',
12 },
13 {
14 id: 'stripe',
15 name: 'Stripe Payments',
16 description:
17 'Accept payments and manage subscriptions with the leading payment processing platform.',
18 type: 'payments',
19 },
20 {
21 id: 'drizzle',
22 name: 'Drizzle ORM',
23 description:
24 'TypeScript-first ORM with excellent DX, type safety, and SQL-like query builder.',
25 type: 'database',
26 },
27 {
28 id: 'prisma',
29 name: 'Prisma ORM',
30 description:
31 'Next-generation ORM with intuitive data modeling, automated migrations, and type safety.',
32 type: 'database',
33 },
34 {
35 id: 'tailwind',
36 name: 'Tailwind CSS',
37 description:
38 'Utility-first CSS framework for rapidly building custom user interfaces.',
39 type: 'styling',
40 },
41 {
42 id: 'shadcn',
43 name: 'shadcn/ui',
44 description:
45 'Beautifully designed components built with Radix UI and Tailwind CSS.',
46 type: 'ui-components',
47 },
48 {
49 id: 'sentry',
50 name: 'Sentry',
51 description:
52 'Error tracking and performance monitoring for your application.',
53 type: 'monitoring',
54 },
55 {
56 id: 'posthog',
57 name: 'PostHog',
58 description:
59 'Product analytics, session recording, and feature flags in one platform.',
60 type: 'analytics',
61 },
62]
63
64// Tool 1: Get available add-ons with their current selection state
65export const getAvailableAddOnsToolDef = toolDefinition({
66 name: 'getAvailableAddOns',
67 description:
68 'Get all available add-ons that can be selected for the project. Returns the list of add-ons with their id, name, description, type, and current selection state.',
69 inputSchema: z.object({}),
70 outputSchema: z.array(
71 z.object({
72 id: z.string(),
73 name: z.string(),
74 description: z.string(),
75 type: z.string(),
76 selected: z.boolean(),
77 enabled: z.boolean(),
78 }),
79 ),
80})
81
82// Tool 2: Select add-ons by ID
83export const selectAddOnsToolDef = toolDefinition({
84 name: 'selectAddOns',
85 description:
86 'Select one or more add-ons by their IDs. This will enable the specified add-ons for the project.',
87 inputSchema: z.object({
88 addOnIds: z
89 .array(z.string())
90 .describe('Array of add-on IDs to select/enable'),
91 }),
92 outputSchema: z.object({
93 success: z.boolean(),
94 selectedAddOns: z.array(z.string()),
95 message: z.string(),
96 }),
97})
98
99// Tool 3: Unselect add-ons by ID
100export const unselectAddOnsToolDef = toolDefinition({
101 name: 'unselectAddOns',
102 description:
103 'Unselect one or more add-ons by their IDs. This will disable the specified add-ons for the project.',
104 inputSchema: z.object({
105 addOnIds: z
106 .array(z.string())
107 .describe('Array of add-on IDs to unselect/disable'),
108 }),
109 outputSchema: z.object({
110 success: z.boolean(),
111 unselectedAddOns: z.array(z.string()),
112 message: z.string(),
113 }),
114})