Skip to content

Commit af65b31

Browse files
authored
Create tools.yaml
1 parent 17b5f66 commit af65b31

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

main/config/tools.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
sources:
2+
neon-postgres:
3+
kind: postgres
4+
host: ${NEON_HOST}
5+
port: 5432
6+
database: ${NEON_DATABASE}
7+
user: ${NEON_USER}
8+
password: ${NEON_PASSWORD}
9+
ssl: require
10+
redis-cache:
11+
kind: redis
12+
url: ${REDIS_URL}
13+
tools:
14+
authenticate-user:
15+
kind: postgres-sql
16+
source: neon-postgres
17+
description: Authenticate user with OAuth and 2FA
18+
parameters:
19+
- name: oauth_token
20+
type: string
21+
description: OAuth token from GitHub
22+
- name: totp_code
23+
type: string
24+
description: TOTP code for 2FA
25+
statement: |
26+
SELECT user_id, access_token
27+
FROM users
28+
WHERE oauth_token = $1 AND totp_verified = true
29+
get-wallet-balance:
30+
kind: postgres-sql
31+
source: neon-postgres
32+
description: Retrieve user wallet balance and transaction history
33+
parameters:
34+
- name: user_id
35+
type: string
36+
description: User identifier
37+
statement: |
38+
SELECT u.balance, u.wallet_address,
39+
json_agg(al.action ORDER BY al.created_at DESC) as recent_actions
40+
FROM users u
41+
LEFT JOIN audit_logs al ON u.user_id = al.user_id
42+
WHERE u.user_id = $1
43+
GROUP BY u.user_id, u.balance, u.wallet_address
44+
manage-vials:
45+
kind: postgres-sql
46+
source: neon-postgres
47+
description: Manage vial states and training operations
48+
parameters:
49+
- name: vial_id
50+
type: string
51+
description: Vial identifier (e.g., vial1)
52+
- name: action
53+
type: string
54+
description: Action to perform (start, stop, train)
55+
- name: dataset
56+
type: string
57+
description: Dataset for training (optional)
58+
optional: true
59+
statement: |
60+
UPDATE vials
61+
SET status = CASE
62+
WHEN $2 = 'start' THEN 'running'
63+
WHEN $2 = 'stop' THEN 'stopped'
64+
WHEN $2 = 'train' THEN 'training'
65+
END,
66+
training_data = CASE
67+
WHEN $2 = 'train' THEN COALESCE($3, training_data)
68+
ELSE training_data
69+
END
70+
WHERE vial_id = $1
71+
RETURNING vial_id, status, training_data
72+
toolsets:
73+
vial-management:
74+
- authenticate-user
75+
- get-wallet-balance
76+
- manage-vials

0 commit comments

Comments
 (0)