@superglue/cli 1.1.0 → 1.1.2

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,624 @@
1
+ ---
2
+ name: superglue
3
+ description: "Build, test, deploy and integrate superglue tools via the sg CLI and superglue SDKs. IMPORTANT — you MUST invoke this skill and read the full reference BEFORE running ANY sg command or writing ANY superglue SDK/REST/webhook integration code. Before using the sg CLI, first check that it is installed (run sg --version; if not found, install with npm install -g @superglue/cli), then verify it is configured (check that sg init has been run or that SUPERGLUE_API_KEY and SUPERGLUE_API_ENDPOINT environment variables are set). If not, guide the user through setup first. After reading the SKILL.md file, also read the relevant references/ files for the specific topic (databases, file servers, transforms, integration/SDK)."
4
+ ---
5
+
6
+ # superglue CLI (`sg`) — Agent Reference
7
+
8
+ ## CRITICAL RULES — READ FIRST
9
+
10
+ **Pre-requisites for using the CLI**
11
+
12
+ 1. **Check CLI exists**: Run `sg --version`. If it fails with `command not found`, install it: `npm install -g @superglue/cli`
13
+ 2. **Check superglue CLI config exists**: Run `sg system list`. If it fails with `fetch failed` or auth errors, the CLI needs configuration via `sg init` (see below).
14
+
15
+ **Authentication & Credentials:**
16
+
17
+ - **Auth headers MUST be set explicitly** — credentials are NEVER auto-injected into requests or tool steps
18
+ - Every request step (in tools AND `sg system call`) must include the appropriate auth header using `<<systemId_credentialKey>>` syntax
19
+ - OAuth systems also require explicit headers — only token refresh is automatic
20
+
21
+ **Saving Tools:**
22
+
23
+ - **Don't save a tool without explicit user confirmation** — always ask "Should I save this tool?" first
24
+ - After `sg tool build` + `sg tool run`, present results to the user and wait for approval
25
+ - Only run `sg tool save --draft <id>` after the user explicitly confirms
26
+
27
+ **Credentials in Non-Interactive Environments (AI Agents, CI):**
28
+
29
+ - **Pass ALL credentials (including secrets) directly via `--credentials` JSON** — do NOT use `--sensitive-credentials` (it requires an interactive TTY which agents don't have)
30
+ - Ask the user to provide secret values, then pass them in `--credentials '{"api_key":"sk-xxx"}'`
31
+
32
+ ---
33
+
34
+ ## Installation & Setup
35
+
36
+ ### Installing the CLI
37
+
38
+ ```bash
39
+ npm install -g @superglue/cli
40
+ ```
41
+
42
+ After installation, the `sg` command is available globally.
43
+
44
+ ### Initialization (REQUIRED before first use)
45
+
46
+ The CLI **will not work** until configured with an API key. The endpoint defaults to `https://api.superglue.cloud` if not specified.
47
+
48
+ **Option A: Interactive setup (recommended for humans)**
49
+
50
+ ```bash
51
+ sg init
52
+ ```
53
+
54
+ This prompts for:
55
+
56
+ 1. **API Key** (required) — get one at https://app.superglue.cloud/admin?view=api-keys
57
+ 2. **API Endpoint** — defaults to `https://api.superglue.cloud`
58
+ 3. **Web Endpoint** — for OAuth callbacks, auto-derived from API endpoint
59
+ 4. **Output mode** — `stdout` (default) or `stdout+file`
60
+ 5. **Config location** — project-local (`.superglue/config.json`) or global (`~/.superglue/config.json`)
61
+
62
+ It verifies the connection before saving. On success it creates the config file, a `drafts/` directory, and updates `.gitignore` if using local config.
63
+
64
+ **Option B: Environment variables (recommended for CI and AI agents)**
65
+
66
+ If `sg init` is not practical (non-interactive environments, CI, AI agents), set these env vars instead:
67
+
68
+ ```bash
69
+ export SUPERGLUE_API_KEY="your-api-key"
70
+ export SUPERGLUE_API_ENDPOINT="https://api.superglue.cloud" # optional, this is the default
71
+ ```
72
+
73
+ With these set, all `sg` commands work without a config file.
74
+
75
+ **Option C: CLI flags (per-command override)**
76
+
77
+ ```bash
78
+ sg system list --api-key "your-key" --endpoint "https://api.superglue.cloud"
79
+ ```
80
+
81
+ ### Config Resolution Order
82
+
83
+ CLI flags > environment variables > config file (local `.superglue/config.json` > global `~/.superglue/config.json`).
84
+
85
+ ### Verifying Setup
86
+
87
+ After configuring, verify the connection works:
88
+
89
+ ```bash
90
+ sg system list # should return a list (possibly empty) without errors
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Quick Start
96
+
97
+ ```bash
98
+ sg system list
99
+ sg tool build --config '{"id":"...","instruction":"...","steps":[...]}'
100
+ sg tool run --draft <draftId>
101
+ sg tool save --draft <draftId>
102
+ ```
103
+
104
+ ## Global Flags
105
+
106
+ | Flag | Description |
107
+ | ------------------ | ------------------------------------------- |
108
+ | `--json` | Force JSON output (auto-enabled in non-TTY) |
109
+ | `--api-key <key>` | Override API key |
110
+ | `--endpoint <url>` | Override API endpoint |
111
+
112
+ ## Command Reference
113
+
114
+ ### `sg init`
115
+
116
+ Interactive setup — API key, endpoint, output mode. Creates `.superglue/`.
117
+
118
+ ### Tool Commands
119
+
120
+ **`sg tool build`** — Register a tool config. Returns a `draftId`. Not AI-powered — you provide the full config.
121
+
122
+ ```bash
123
+ sg tool build --config '{"id":"...","steps":[...]}' # inline JSON
124
+ sg tool build --id my-tool --instruction "..." --steps steps.json --payload '{"key":"val"}'
125
+ sg tool build --config tool.json # from file
126
+ ```
127
+
128
+ | `--config <file-or-json>` | Full JSON config (file path or inline JSON string) |
129
+ | `--id <id>` | Tool ID (kebab-case) |
130
+ | `--instruction <text>` | Human-readable description |
131
+ | `--steps <file>` | JSON file with steps array |
132
+ | `--payload <json>` | Sample payload |
133
+ | `--file <key=path>` | Attach file reference |
134
+
135
+ **`sg tool run`** — Execute a draft or saved tool. Streams live execution logs to the terminal.
136
+
137
+ ```bash
138
+ sg tool run --draft <draftId> --payload '{"userId":"123"}'
139
+ sg tool run --tool my-tool --payload-file payload.json
140
+ ```
141
+
142
+ | `--draft <id>` / `--tool <id>` | Draft ID or saved tool ID |
143
+ | `--payload <json>` / `--payload-file <path>` | Payload |
144
+ | `--include-step-results` | Include raw step results |
145
+ | `--include-config` | Include full tool config |
146
+
147
+ **`sg tool edit`** — Apply JSON Patch (RFC 6902) operations.
148
+
149
+ ```bash
150
+ sg tool edit --draft <draftId> --patches '[{"op":"replace","path":"/steps/0/config/url","value":"..."}]'
151
+ sg tool edit --tool my-tool --patches patches.json
152
+ ```
153
+
154
+ | `--patches <json-or-file>` | JSON Patch array (inline or file) |
155
+
156
+ **`sg tool save`** — Persist draft to database. Deletes draft file on success.
157
+
158
+ ```bash
159
+ sg tool save --draft <draftId>
160
+ ```
161
+
162
+ **`sg tool list` / `sg tool find`**
163
+
164
+ ```bash
165
+ sg tool list # all non-archived tools
166
+ sg tool find "shopify orders" # search (compact results)
167
+ sg tool find --id my-tool # exact ID lookup (full config)
168
+ ```
169
+
170
+ ### System Commands
171
+
172
+ **`sg system create`**
173
+
174
+ **Required flags:**
175
+
176
+ - `--id <id>` — System ID (lowercase, underscores only, no hyphens)
177
+ - `--name <name>` — Human-readable display name
178
+ - `--url <url>` — API base URL (auto-filled when using `--template`)
179
+
180
+ **At least one of:**
181
+
182
+ - `--template <id>` — Pre-configured template (auto-fills name and url if not provided)
183
+ - `--url <url>` + `--name <name>` manually
184
+
185
+ **Example with credentials (non-interactive — use this in AI agent / CI contexts):**
186
+
187
+ ```bash
188
+ sg system create --id my_api --name "My API" --url https://api.example.com \
189
+ --credentials '{"api_key":"sk-xxx"}'
190
+ ```
191
+
192
+ **With template:**
193
+
194
+ ```bash
195
+ sg system create --id slack --name "Slack" --template slack
196
+ ```
197
+
198
+ **Full flag reference:**
199
+
200
+ | Flag | Description |
201
+ | ---------------------------------- | ---------------------------------------------------------------------------- |
202
+ | `--id <id>` | System ID (lowercase, underscores only) — **REQUIRED** |
203
+ | `--name <name>` | Human-readable name — **REQUIRED** |
204
+ | `--url <url>` | API base URL — **REQUIRED** (auto-filled by `--template`) |
205
+ | `--template <id>` | Template ID (stripe, shopify, slack, etc.) |
206
+ | `--credentials <json>` | Credentials JSON (use for ALL creds in non-interactive mode) |
207
+ | `--sensitive-credentials <fields>` | Comma-separated fields for masked input (TTY only — do NOT use in AI agents) |
208
+ | `--docs-url <url>` | Documentation URL to scrape |
209
+ | `--openapi-url <url>` | OpenAPI spec URL |
210
+ | `--env <environment>` | Environment: `dev` or `prod` (default: prod) |
211
+
212
+ **`sg system edit`** — Update system config or credentials. Supports `--env dev|prod`.
213
+ **`sg system list` / `sg system find`** — List or search systems. `find` supports `--env dev|prod`.
214
+
215
+ **`sg system call`** — **CRITICAL for tool building.** Make authenticated calls to APIs, databases, and file servers. Use this to:
216
+
217
+ - Explore API endpoints and response structures
218
+ - Verify field names and data shapes BEFORE building tools
219
+
220
+ ```bash
221
+
222
+ # POST request with auth and body
223
+ sg system call --url https://api.example.com/users \
224
+ --system-id my_api \
225
+ --method POST \
226
+ --headers '{"Authorization":"Bearer <<my_api_access_token>>"}' \
227
+ --body '{"name":"test"}'
228
+
229
+ # Database query (Postgres)
230
+ sg system call --url "postgres://<<my_db_host>>:5432/mydb" \
231
+ --system-id my_db \
232
+ --body '{"query":"SELECT * FROM users LIMIT 5"}'
233
+
234
+ # File server (SFTP)
235
+ sg system call --url "sftp://<<my_sftp_host>>:22/data" \
236
+ --system-id my_sftp \
237
+ --body '{"operation":"list","path":"/"}'
238
+ ```
239
+
240
+ | Flag | Description |
241
+ | ------------------- | --------------------------------------------------------- |
242
+ | `--url <url>` | Full URL with protocol (http/https/postgres/sftp/ftp/smb) |
243
+ | `--system-id <id>` | System ID for credential injection |
244
+ | `--method <method>` | HTTP method (GET, POST, PUT, DELETE, PATCH) |
245
+ | `--headers <json>` | HTTP headers JSON with credential placeholders |
246
+ | `--body <string>` | Request body (JSON string) |
247
+ | `--env <env>` | Environment: `dev` or `prod` |
248
+ | `--file <key=path>` | File references (repeatable) |
249
+
250
+ **`sg system search-docs`** — Search system documentation.
251
+
252
+ ```bash
253
+ sg system search-docs --system-id slack -k "send message channels"
254
+ ```
255
+
256
+ **`sg system oauth`** — Authenticate via OAuth.
257
+
258
+ ```bash
259
+ sg system oauth --system-id gmail --scopes "https://www.googleapis.com/auth/gmail.readonly"
260
+ sg system oauth --system-id my_api --grant-type client_credentials --scopes "read write"
261
+ ```
262
+
263
+ | `--system-id <id>` | Required |
264
+ | `--scopes <scopes>` | Space-separated OAuth scopes (required) |
265
+ | `--grant-type <type>` | `authorization_code` (default) or `client_credentials` |
266
+
267
+ ### Run Commands
268
+
269
+ **`sg run list`** — List execution runs. Filter by `--tool`, `--status`, `--source`, `--limit`.
270
+ **`sg run get <runId>`** — Get run details. `--fetch-results` to include data.
271
+
272
+ ---
273
+
274
+ ## Tool Configuration — Full Schema
275
+
276
+ ```json
277
+ {
278
+ "id": "kebab-case-tool-name",
279
+ "instruction": "Brief human-readable description of what this tool does",
280
+ "steps": [
281
+ {
282
+ "id": "unique-step-id",
283
+ "config": {
284
+ "systemId": "example_system",
285
+ "url": "https://api.example.com/endpoint?param=<<payload_field>>",
286
+ "method": "GET",
287
+ "headers": {
288
+ "Authorization": "Bearer <<example_system_access_token>>"
289
+ },
290
+ "queryParams": { "limit": "10" },
291
+ "body": "{ \"key\": \"<<payload_field>>\" }"
292
+ },
293
+ "dataSelector": "(sourceData) => sourceData.previousStep.data.items",
294
+ "failureBehavior": "fail"
295
+ }
296
+ ],
297
+ "outputTransform": "(sourceData) => sourceData.stepId.data",
298
+ "outputSchema": { "type": "object", "properties": {} },
299
+ "inputSchema": { "type": "object", "properties": {} }
300
+ }
301
+ ```
302
+
303
+ ### Step Config Fields (Request Steps)
304
+
305
+ | Field | Type | Description |
306
+ | ------------- | ------ | -------------------------------------------- |
307
+ | `type` | string | `"request"` (default, can be omitted) |
308
+ | `systemId` | string | System whose credentials to use |
309
+ | `url` | string | Full URL with `<<variable>>` placeholders |
310
+ | `method` | string | HTTP method |
311
+ | `headers` | object | HTTP headers with credential placeholders |
312
+ | `queryParams` | object | URL query parameters |
313
+ | `body` | string | Request body (JSON string with placeholders) |
314
+ | `pagination` | object | Auto-pagination config (see below) |
315
+
316
+ ### Step Config Fields (Transform Steps)
317
+
318
+ | Field | Type | Description |
319
+ | --------------- | ------ | ------------------------------------------------ |
320
+ | `type` | string | `"transform"` — **REQUIRED** for transform steps |
321
+ | `transformCode` | string | JS function: `(sourceData) => transformedData` |
322
+
323
+ ### Step Behavior Fields
324
+
325
+ | Field | Type | Description |
326
+ | ----------------- | ------ | ------------------------------------------------ |
327
+ | `dataSelector` | string | JS function controlling step input and loop mode |
328
+ | `failureBehavior` | string | `fail` (default) or `continue` |
329
+
330
+ ---
331
+
332
+ ## Credential Placeholders
333
+
334
+ System credentials are namespaced as `<<systemId_credentialKey>>` and resolved server-side at execution time. **You MUST explicitly reference them in headers.**
335
+
336
+ ### Auth Header Patterns
337
+
338
+ ```json
339
+ {"Authorization": "Bearer <<stripe_api_key>>"}
340
+ {"Authorization": "Bearer <<gmail_access_token>>"}
341
+ {"X-API-Key": "<<my_api_api_key>>"}
342
+ {"Authorization": "Basic <<my_api_username>>:<<my_api_password>>"}
343
+ ```
344
+
345
+ Basic auth is auto-encoded: if the value after `Basic ` isn't already base64, the engine encodes it automatically.
346
+
347
+ ### Credential Lifecycle
348
+
349
+ - Non-sensitive creds (`client_id`, `auth_url`, etc.) are stored via `--credentials`
350
+ - Sensitive creds (`api_key`, `client_secret`) — in non-interactive mode (AI agents, CI), pass via `--credentials` JSON. In interactive TTY, use `--sensitive-credentials` for masked input, or set `SUPERGLUE_CRED_<FIELD>` env vars.
351
+ - OAuth tokens (`access_token`, `refresh_token`) are auto-refreshed before each step execution
352
+
353
+ ---
354
+
355
+ ## Variables and Data Flow
356
+
357
+ ### Variable Syntax
358
+
359
+ All step config fields support `<<variable>>` placeholders:
360
+
361
+ | Syntax | Resolves to |
362
+ | -------------------------- | --------------------------- |
363
+ | `<<fieldName>>` | Payload field or credential |
364
+ | `<<systemId_credKey>>` | System credential |
365
+ | `<<(sourceData) => expr>>` | JavaScript expression |
366
+
367
+ **CRITICAL**: Simple `<<varName>>` only works for **top-level keys**. No dots, no nesting.
368
+
369
+ - VALID: `<<userId>>`, `<<currentItem>>`, `<<stripe_api_key>>`
370
+ - INVALID: `<<currentItem.id>>`, `<<sourceData.userId>>` — these FAIL at runtime
371
+
372
+ For nested access, use arrow functions: `<<(sourceData) => sourceData.currentItem.id>>`
373
+
374
+ ### sourceData Object
375
+
376
+ `sourceData` is the cumulative state available to all JS expressions (data selectors, transforms, variable expressions):
377
+
378
+ ```javascript
379
+ sourceData = {
380
+ // Payload fields at ROOT level (NEVER use sourceData.payload.*)
381
+ userId: "123",
382
+ date: "2024-01-15",
383
+
384
+ // Previous step results, keyed by step ID
385
+ // Object-selector step:
386
+ getUsers: { currentItem: {}, data: { users: [...] }, success: true },
387
+ // Array-selector (loop) step:
388
+ fetchDetails: [
389
+ { currentItem: "id1", data: { name: "Alice" }, success: true },
390
+ { currentItem: "id2", data: { name: "Bob" }, success: true },
391
+ ],
392
+
393
+ // Current loop item (only set inside a looping step's config)
394
+ currentItem: { id: 1 },
395
+
396
+ // Credentials (flattened, namespaced)
397
+ systemId_access_token: "...",
398
+ systemId_api_key: "..."
399
+ }
400
+ ```
401
+
402
+ ### Step Result Envelope
403
+
404
+ **Every** step result is wrapped in an envelope — you MUST account for this.
405
+
406
+ **Object selector (or no selector)** — step runs once:
407
+
408
+ ```javascript
409
+ sourceData.stepId = { currentItem: <selectorOutput>, data: <apiResponse>, success: true }
410
+ // Access the API response:
411
+ sourceData.stepId.data
412
+ sourceData.stepId.data.users
413
+ ```
414
+
415
+ **Array selector** — step loops, result is an array of envelopes:
416
+
417
+ ```javascript
418
+ sourceData.stepId = [
419
+ { currentItem: <item1>, data: <response1>, success: true },
420
+ { currentItem: <item2>, data: <response2>, success: true },
421
+ ...
422
+ ]
423
+ ```
424
+
425
+ ### Data Selectors
426
+
427
+ Control what a step receives as input and whether it loops:
428
+
429
+ | Return type | Behavior |
430
+ | ------------------ | ----------------------------------- |
431
+ | Single object | Step runs once with that object |
432
+ | Array | Step runs once per item (loop mode) |
433
+ | `undefined`/`null` | Step receives full sourceData |
434
+
435
+ In loop mode, `sourceData.currentItem` is set to the current array element.
436
+
437
+ Empty arrays are valid — the step simply skips execution.
438
+
439
+ ### Two Step Types
440
+
441
+ **Request step** (HTTP, Postgres, FTP/SFTP/SMB) — makes an API call:
442
+
443
+ ```json
444
+ {
445
+ "id": "get-users",
446
+ "config": {
447
+ "type": "request",
448
+ "systemId": "my_api",
449
+ "url": "https://api.example.com/users",
450
+ "method": "GET",
451
+ "headers": { "Authorization": "Bearer <<my_api_access_token>>" }
452
+ }
453
+ }
454
+ ```
455
+
456
+ **Transform step** — pure JavaScript, no API call. Use when a subsequent request step needs reshaped data:
457
+
458
+ ```json
459
+ {
460
+ "id": "format-data",
461
+ "config": {
462
+ "type": "transform",
463
+ "transformCode": "(sourceData) => sourceData.getUsers.data.map(u => ({ id: u.id, name: u.fullName }))"
464
+ }
465
+ }
466
+ ```
467
+
468
+ Transform steps do NOT have: `systemId`, `url`, `method`, `headers`, `body`, `queryParams`, or `pagination`. The `transformCode` function receives `sourceData` (same object available everywhere) and its return value becomes `.data` in the step envelope.
469
+
470
+ **When to use each:**
471
+
472
+ | Need | Use |
473
+ | ------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
474
+ | Filter/reshape data for a SUBSEQUENT request step | Transform step (`config.type: "transform"`) |
475
+ | Shape the final tool output | `outputTransform` (runs after all steps, has a slightly different schema than transform only steps) |
476
+ | Select input / control looping for a step | `dataSelector` on the step |
477
+ | Inline data computation in URL/body/headers | `<<(sourceData) => ...>>` expressions |
478
+
479
+ ### Execution Pipeline
480
+
481
+ For each step in order:
482
+
483
+ 1. Build `sourceData`: `{ ...originalPayload, ...previousStepResults, ...credentials }`
484
+ 2. Run `dataSelector(sourceData)` → determines single vs loop execution
485
+ 3. For each item: merge `currentItem` into `sourceData`, resolve `<<>>` variables, execute step
486
+ - **Request step**: makes the HTTP/DB/FTP call, raw response becomes `.data`
487
+ - **Transform step**: runs `transformCode(sourceData)`, return value becomes `.data`
488
+ 4. Wrap result: `{ currentItem, data, success }` and store in `sourceData[stepId]`
489
+ 5. After all steps: run `outputTransform(sourceData)` to shape final output
490
+
491
+ ---
492
+
493
+ ## HTTP API Patterns
494
+
495
+ ### Pagination
496
+
497
+ ```json
498
+ {
499
+ "pagination": {
500
+ "type": "offset|cursor|page",
501
+ "pageSize": 100,
502
+ "cursorPath": "$.nextPageToken",
503
+ "stopCondition": "(response) => !response.hasMore"
504
+ }
505
+ }
506
+ ```
507
+
508
+ | Type | How it works |
509
+ | -------- | ------------------------------------------------------------ |
510
+ | `offset` | Increments `offset` param by `pageSize` each page |
511
+ | `cursor` | Extracts next cursor from `cursorPath`, sends as query param |
512
+ | `page` | Increments `page` query param |
513
+
514
+ All types stop when `stopCondition` returns true, response is empty, or max pages reached.
515
+
516
+ ## Systems
517
+
518
+ ### Credential Model
519
+
520
+ - `credentials` — all credentials passed as JSON via `--credentials`
521
+ - `sensitiveCredentials` — interactive masked prompt for secrets (TTY only, NOT for AI agents or CI)
522
+ - **For AI agents / non-interactive use:** pass ALL credentials (including secrets like api_key, client_secret) directly via `--credentials '{"api_key":"..."}'`. Ask the user to provide the secret values, then include them in the JSON.
523
+ - **For human interactive use:** use `--sensitive-credentials` for masked input of secrets
524
+
525
+ ### Templates
526
+
527
+ Templates auto-populate endpoints and OAuth config. Use `sg system find` to discover available templates.
528
+
529
+ **Preconfigured OAuth** (no user client_id/secret needed): slack, salesforce, asana, notion, airtable, jira, confluence
530
+
531
+ ### OAuth Flow
532
+
533
+ 1. `sg system create --id gmail --url https://gmail.googleapis.com --credentials '{"auth_url":"...","token_url":"..."}' --sensitive-credentials client_id,client_secret`
534
+ 2. `sg system oauth --system-id gmail --scopes "..."`
535
+ 3. User authenticates in browser → tokens saved automatically
536
+
537
+ ### System IDs
538
+
539
+ - Lowercase letters, numbers, underscores only — **no hyphens**
540
+ - Used for credential namespacing: `<<systemId_credKey>>`
541
+
542
+ ---
543
+
544
+ ## Debugging Failed Tools
545
+
546
+ ### Debug Workflow
547
+
548
+ 1. Run with `--include-step-results` to see raw step responses
549
+ 2. Check each step's `data` field — is the API returning what you expect?
550
+ 3. Verify credential placeholders match `sg system find --id <systemId>` placeholder list
551
+ 4. **Test API calls directly with `sg system call`** — isolate whether the issue is auth, endpoint, or transform
552
+
553
+ ---
554
+
555
+ ## Deploying Tools to Production
556
+
557
+ After building and saving a tool, integrate it into your application:
558
+
559
+ ### REST API (Any Language)
560
+
561
+ ```bash
562
+ # Run a tool
563
+ curl -X POST "https://api.superglue.cloud/v1/tools/{toolId}/run" \
564
+ -H "Authorization: Bearer $SUPERGLUE_API_KEY" \
565
+ -H "Content-Type: application/json" \
566
+ -d '{"inputs": {"userId": "123"}}'
567
+
568
+ # Webhook trigger (async, fire-and-forget)
569
+ curl -X POST "https://api.superglue.cloud/v1/hooks/{toolId}?token=$SUPERGLUE_API_KEY" \
570
+ -H "Content-Type: application/json" \
571
+ -d '{"userId": "123"}'
572
+ ```
573
+
574
+ ### TypeScript SDK
575
+
576
+ ```typescript
577
+ import { configure, runTool } from "@superglue/client";
578
+ configure({ apiKey: process.env.SUPERGLUE_API_KEY!, baseUrl: "https://api.superglue.cloud/v1" });
579
+ const response = await runTool("my-tool-id", { inputs: { userId: "123" } });
580
+ // response.data is a Run object: { runId, toolId, status, data, error, metadata }
581
+ ```
582
+
583
+ ### Python SDK
584
+
585
+ ```python
586
+ import os
587
+ from superglue_client import AuthenticatedClient
588
+ from superglue_client.api.tools import run_tool
589
+ from superglue_client.models.run_request import RunRequest
590
+ from superglue_client.models.run_request_inputs import RunRequestInputs
591
+
592
+ client = AuthenticatedClient(base_url="https://api.superglue.cloud/v1", token=os.environ["SUPERGLUE_API_KEY"])
593
+ with client as c:
594
+ result = run_tool.sync("my-tool-id", client=c, body=RunRequest(inputs=RunRequestInputs.from_dict({"userId": "123"})))
595
+ ```
596
+
597
+ ---
598
+
599
+ ## Reference Files
600
+
601
+ For detailed documentation on specific topics, read these files in the `references/` directory:
602
+
603
+ | File | When to read |
604
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------ |
605
+ | `references/integration.md` | **READ THIS** when deploying tools to production - SDK usage, REST API, webhooks, error handling |
606
+ | `references/databases.md` | Building tools that query PostgreSQL/MySQL databases |
607
+ | `references/file-servers.md` | Building tools that interact with FTP/SFTP/SMB file servers |
608
+ | `references/transforms-and-output.md` | Complex data transformations, output shaping, JS sandbox constraints |
609
+
610
+ **Important:** When the user asks about integrating superglue into their codebase, deploying tools, using the SDK, or calling tools from code, you MUST read `references/integration.md` for complete examples.
611
+
612
+ ---
613
+
614
+ ## Draft Management
615
+
616
+ Drafts live in `.superglue/drafts/<draftId>.json`. Created by `build`, updated by `edit`, deleted by `save`. Ephemeral — not persisted across sessions.
617
+
618
+ ## File References
619
+
620
+ Attach files with `--file key=path`. Reference in payloads with `file::<key>`. Auto-parsed via `/v1/extract`.
621
+
622
+ ```bash
623
+ sg tool run --draft <id> --payload '{"data": "file::mysheet"}' --file mysheet=data.xlsx
624
+ ```
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "superglue"
3
+ short_description: "Build, test, deploy, and integrate superglue API tools via the sg CLI and SDK"
4
+ icon_small: "./assets/superglue.png"
5
+ icon_large: "./assets/superglue.png"
6
+ brand_color: "#FFA500"
7
+ default_prompt: "I need help building a superglue integration tool"