@mindstudio-ai/agent 0.1.0 → 0.1.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.
- package/README.md +42 -6
- package/dist/cli.js +469 -50
- package/dist/index.d.ts +379 -2
- package/dist/index.js +135 -0
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +3522 -0
- package/llms.txt +168 -7
- package/package.json +2 -1
package/llms.txt
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
# @mindstudio-ai/agent
|
|
2
2
|
|
|
3
|
-
TypeScript SDK, CLI, and MCP server for MindStudio. One API key gives you access to 200+ AI models (OpenAI, Anthropic, Google, Meta, xAI, DeepSeek, etc.) and 1,000+
|
|
3
|
+
TypeScript SDK, CLI, and MCP server for MindStudio. One API key gives you access to 200+ AI models (OpenAI, Anthropic, Google, Meta, xAI, DeepSeek, etc.) and 1,000+ actions including 850+ connector actions across third-party services from the open-source MindStudio Connector Registry (https://github.com/mindstudio-ai/mscr). No separate provider API keys required.
|
|
4
4
|
|
|
5
5
|
This file is the complete API reference. No other documentation is needed to use the SDK.
|
|
6
6
|
|
|
7
|
+
## Recommended workflow
|
|
8
|
+
|
|
9
|
+
There are 150+ methods available. Do NOT try to read or load them all at once. Follow this discovery flow:
|
|
10
|
+
|
|
11
|
+
1. **Identify yourself** — Call `changeName` to set your display name (use your name or whatever your user calls you). If you have a profile picture or icon, call `uploadFile` to upload it, then `changeProfilePicture` with the returned URL. This helps users identify your requests in their logs.
|
|
12
|
+
2. **Discover** — Call `listSteps` (MCP tool) or `mindstudio list --summary` (CLI) to get a compact `{ method: description }` map of everything available (~3k tokens).
|
|
13
|
+
3. **Drill in** — Once you identify the right method, look up its full signature in the Methods reference below, or call `mindstudio info <method>` (CLI) for parameter details.
|
|
14
|
+
4. **Call it** — Invoke the method with the required parameters. All step methods share the same calling convention (see below).
|
|
15
|
+
|
|
16
|
+
For specific use cases:
|
|
17
|
+
|
|
18
|
+
- **Third-party integrations** (Slack, Google, HubSpot, etc.): Call `listConnectors()` to browse services → `getConnectorAction(serviceId, actionId)` for input fields → execute via `runFromConnectorRegistry`. Requires an OAuth connection set up in MindStudio first — call `listConnections()` to check available connections.
|
|
19
|
+
- **Pre-built agents**: Call `listAgents()` to see what's available → `runAgent({ appId })` to execute one. Agents are full workflows built in MindStudio — they can combine multiple steps, have custom logic, and maintain their own state.
|
|
20
|
+
- **Model selection**: Call `listModelsSummary()` or `listModelsSummaryByType("llm_chat")` to browse models, then pass the model ID as `modelOverride.model` to methods like `generateText`. Use the summary endpoints (not `listModels`) to keep token usage low.
|
|
21
|
+
- **Cost estimation**: Call `estimateStepCost(stepType, stepInput)` before expensive calls to preview pricing.
|
|
22
|
+
|
|
7
23
|
## Install
|
|
8
24
|
|
|
25
|
+
Standalone binary (CLI/MCP, no dependencies):
|
|
26
|
+
```bash
|
|
27
|
+
curl -fsSL https://msagent.ai/install.sh | bash
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
npm (SDK + CLI):
|
|
9
31
|
```bash
|
|
10
32
|
npm install @mindstudio-ai/agent
|
|
11
33
|
```
|
|
@@ -26,7 +48,10 @@ mindstudio generate-image '{prompt: "A mountain landscape"}'
|
|
|
26
48
|
# Extract a single output field
|
|
27
49
|
mindstudio generate-image --prompt "A sunset" --output-key imageUrl
|
|
28
50
|
|
|
29
|
-
# List all
|
|
51
|
+
# List all methods (compact JSON — best for LLM discovery)
|
|
52
|
+
mindstudio list --summary
|
|
53
|
+
|
|
54
|
+
# List all methods (human-readable table)
|
|
30
55
|
mindstudio list
|
|
31
56
|
|
|
32
57
|
# Show method details (params, types, output)
|
|
@@ -57,19 +82,19 @@ Auth resolution order: `--api-key` flag > `MINDSTUDIO_API_KEY` env > `~/.mindstu
|
|
|
57
82
|
|
|
58
83
|
## MCP server
|
|
59
84
|
|
|
60
|
-
The package includes an MCP server exposing all methods as tools
|
|
85
|
+
The package includes an MCP server exposing all methods as tools. Start by calling the `listSteps` tool to discover available methods.
|
|
61
86
|
|
|
62
87
|
```bash
|
|
63
88
|
mindstudio mcp
|
|
64
89
|
```
|
|
65
90
|
|
|
66
|
-
MCP client config:
|
|
91
|
+
MCP client config (standalone binary — recommended):
|
|
67
92
|
```json
|
|
68
93
|
{
|
|
69
94
|
"mcpServers": {
|
|
70
95
|
"mindstudio": {
|
|
71
|
-
"command": "
|
|
72
|
-
"args": ["
|
|
96
|
+
"command": "mindstudio",
|
|
97
|
+
"args": ["mcp"],
|
|
73
98
|
"env": { "MINDSTUDIO_API_KEY": "your-api-key" }
|
|
74
99
|
}
|
|
75
100
|
}
|
|
@@ -227,6 +252,14 @@ Create a new empty vector data source for the current app.
|
|
|
227
252
|
- Input: `{ name: string }`
|
|
228
253
|
- Output: `unknown`
|
|
229
254
|
|
|
255
|
+
#### createGmailDraft
|
|
256
|
+
Create a draft email in the connected Gmail account.
|
|
257
|
+
- Requires a Google OAuth connection with Gmail compose scope.
|
|
258
|
+
- The draft appears in the user's Gmail Drafts folder but is not sent.
|
|
259
|
+
- messageType controls the body format: "plain" for plain text, "html" for raw HTML, "markdown" for auto-converted markdown.
|
|
260
|
+
- Input: `{ to: string, subject: string, message: string, connectionId?: string, messageType: "plain" | "html" | "markdown" }`
|
|
261
|
+
- Output: `{ draftId: string }`
|
|
262
|
+
|
|
230
263
|
#### deleteDataSource
|
|
231
264
|
Delete a vector data source from the current app.
|
|
232
265
|
- Soft-deletes a data source (vector database) by marking it as deleted.
|
|
@@ -408,6 +441,23 @@ Generate a video from a text prompt using an AI model.
|
|
|
408
441
|
- Input: `{ prompt: string, skipAssetCreation?: boolean, videoModelOverride?: { model: string, config?: object }, generateVariants?: boolean, numVariants?: number, addWatermark?: boolean }`
|
|
409
442
|
- Output: `{ videoUrl: string | string[] }`
|
|
410
443
|
|
|
444
|
+
#### getGmailAttachments
|
|
445
|
+
Download attachments from a Gmail email and re-host them on CDN.
|
|
446
|
+
- Requires a Google OAuth connection with Gmail readonly scope.
|
|
447
|
+
- Attachments are uploaded to CDN and returned as URLs.
|
|
448
|
+
- Attachments larger than 25MB are skipped.
|
|
449
|
+
- Use the message ID from Search Gmail Emails, List Recent Gmail Emails, or Get Gmail Email steps.
|
|
450
|
+
- Input: `{ messageId: string, connectionId?: string }`
|
|
451
|
+
- Output: `unknown`
|
|
452
|
+
|
|
453
|
+
#### getGmailUnreadCount
|
|
454
|
+
Get the number of unread emails in the connected Gmail inbox.
|
|
455
|
+
- Requires a Google OAuth connection with Gmail readonly scope.
|
|
456
|
+
- Returns the unread message count for the inbox label.
|
|
457
|
+
- This is a lightweight call that does not fetch any email content.
|
|
458
|
+
- Input: `{ connectionId?: string }`
|
|
459
|
+
- Output: `unknown`
|
|
460
|
+
|
|
411
461
|
#### getMediaMetadata
|
|
412
462
|
Get info about a media file
|
|
413
463
|
- Input: `{ mediaUrl: string }`
|
|
@@ -445,6 +495,22 @@ List all data sources for the current app.
|
|
|
445
495
|
- Input: `object`
|
|
446
496
|
- Output: `unknown`
|
|
447
497
|
|
|
498
|
+
#### listGmailLabels
|
|
499
|
+
List all labels in the connected Gmail account. Use these label IDs or names with the Update Gmail Labels step.
|
|
500
|
+
- Requires a Google OAuth connection with Gmail readonly scope.
|
|
501
|
+
- Returns both system labels (INBOX, SENT, TRASH, etc.) and user-created labels.
|
|
502
|
+
- Label type is "system" for built-in labels or "user" for custom labels.
|
|
503
|
+
- Input: `{ connectionId?: string }`
|
|
504
|
+
- Output: `unknown`
|
|
505
|
+
|
|
506
|
+
#### listRecentGmailEmails
|
|
507
|
+
List recent emails from the connected Gmail inbox.
|
|
508
|
+
- Requires a Google OAuth connection with Gmail readonly scope.
|
|
509
|
+
- Returns up to 100 emails (default 5), ordered by most recent first.
|
|
510
|
+
- Functionally equivalent to Search Gmail Emails with an "in:inbox" query.
|
|
511
|
+
- Input: `{ connectionId?: string, exportType: "json" | "text", limit: string }`
|
|
512
|
+
- Output: `unknown`
|
|
513
|
+
|
|
448
514
|
#### logic
|
|
449
515
|
Route execution to different branches based on AI evaluation, comparison operators, or workflow jumps.
|
|
450
516
|
- Supports two modes: "ai" (default) uses an AI model to pick the most accurate statement; "comparison" uses operator-based checks.
|
|
@@ -595,6 +661,16 @@ Scrape public profile data from an X (Twitter) account by URL.
|
|
|
595
661
|
- Input: `{ url: string }`
|
|
596
662
|
- Output: `{ profile: { text: string, html: string, json?: object, screenshotUrl?: string, metadata?: { title: string, description: string, url: string, image: string } } }`
|
|
597
663
|
|
|
664
|
+
#### searchGmailEmails
|
|
665
|
+
Search for emails in the connected Gmail account using a Gmail search query. To list recent inbox emails, pass an empty query string.
|
|
666
|
+
- Requires a Google OAuth connection with Gmail readonly scope.
|
|
667
|
+
- Uses Gmail search syntax (e.g. "from:user@example.com", "subject:invoice", "is:unread").
|
|
668
|
+
- To list recent inbox emails, use an empty query string or "in:inbox".
|
|
669
|
+
- Returns up to 100 emails (default 5). The variable receives text or JSON depending on exportType.
|
|
670
|
+
- The direct execution output always returns structured email objects.
|
|
671
|
+
- Input: `{ query: string, connectionId?: string, exportType: "json" | "text", limit: string }`
|
|
672
|
+
- Output: `{ emails: { id: string, subject: string, from: string, to: string, date: string, plainBody: string, htmlBody: string, labels: string }[] }`
|
|
673
|
+
|
|
598
674
|
#### searchGoogle
|
|
599
675
|
Search the web using Google and return structured results.
|
|
600
676
|
- Defaults to us/english, but can optionally specify country and/or language.
|
|
@@ -642,6 +718,21 @@ Send an email to one or more configured recipient addresses.
|
|
|
642
718
|
- Input: `{ subject: string, body: string, connectionId?: string, generateHtml?: boolean, generateHtmlInstructions?: string, generateHtmlModelOverride?: { model: string, temperature: number, maxResponseTokens: number, ignorePreamble?: boolean, userMessagePreprocessor?: { dataSource?: string, messageTemplate?: string, maxResults?: number, enabled?: boolean, shouldInherit?: boolean }, preamble?: string, multiModelEnabled?: boolean, editResponseEnabled?: boolean, config?: object }, attachments?: string[] }`
|
|
643
719
|
- Output: `{ recipients: string[] }`
|
|
644
720
|
|
|
721
|
+
#### sendGmailDraft
|
|
722
|
+
Send an existing draft from the connected Gmail account.
|
|
723
|
+
- Requires a Google OAuth connection with Gmail compose scope.
|
|
724
|
+
- The draft is sent and removed from the Drafts folder.
|
|
725
|
+
- Use the draft ID returned by the Create Gmail Draft or List Gmail Drafts steps.
|
|
726
|
+
- Input: `{ draftId: string, connectionId?: string }`
|
|
727
|
+
- Output: `unknown`
|
|
728
|
+
|
|
729
|
+
#### sendGmailMessage
|
|
730
|
+
Send an email from the connected Gmail account.
|
|
731
|
+
- Requires a Google OAuth connection with Gmail compose scope.
|
|
732
|
+
- messageType controls the body format: "plain" for plain text, "html" for raw HTML, "markdown" for auto-converted markdown.
|
|
733
|
+
- Input: `{ to: string, subject: string, message: string, connectionId?: string, messageType: "plain" | "html" | "markdown" }`
|
|
734
|
+
- Output: `{ messageId: string }`
|
|
735
|
+
|
|
645
736
|
#### sendSMS
|
|
646
737
|
Send an SMS or MMS message to a phone number configured via OAuth connection.
|
|
647
738
|
- User is responsible for configuring the connection to the number (MindStudio requires double opt-in to prevent spam)
|
|
@@ -651,6 +742,14 @@ Send an SMS or MMS message to a phone number configured via OAuth connection.
|
|
|
651
742
|
- Input: `{ body: string, connectionId?: string, mediaUrls?: string[] }`
|
|
652
743
|
- Output: `unknown`
|
|
653
744
|
|
|
745
|
+
#### setGmailReadStatus
|
|
746
|
+
Mark one or more Gmail emails as read or unread.
|
|
747
|
+
- Requires a Google OAuth connection with Gmail modify scope.
|
|
748
|
+
- Accepts one or more message IDs as a comma-separated string or array.
|
|
749
|
+
- Set markAsRead to true to mark as read, false to mark as unread.
|
|
750
|
+
- Input: `{ messageIds: string, markAsRead: boolean, connectionId?: string }`
|
|
751
|
+
- Output: `unknown`
|
|
752
|
+
|
|
654
753
|
#### setRunTitle
|
|
655
754
|
Set the title of the agent run for the user's history
|
|
656
755
|
- Input: `{ title: string }`
|
|
@@ -733,6 +832,14 @@ Trim an audio or video clip
|
|
|
733
832
|
- Input: `{ inputUrl: string, start?: number | string, duration?: string | number, skipAssetCreation?: boolean }`
|
|
734
833
|
- Output: `{ mediaUrl: string }`
|
|
735
834
|
|
|
835
|
+
#### updateGmailLabels
|
|
836
|
+
Add or remove labels on Gmail messages, identified by message IDs or a search query.
|
|
837
|
+
- Requires a Google OAuth connection with Gmail modify scope.
|
|
838
|
+
- Provide either a query (Gmail search syntax) or explicit messageIds to target messages.
|
|
839
|
+
- Label IDs can be label names or Gmail label IDs — names are resolved automatically.
|
|
840
|
+
- Input: `{ query: string, connectionId?: string, messageIds: string, addLabelIds: string, removeLabelIds: string }`
|
|
841
|
+
- Output: `{ updatedMessageIds: string[] }`
|
|
842
|
+
|
|
736
843
|
#### uploadDataSourceDocument
|
|
737
844
|
Upload a file into an existing data source from a URL or raw text content.
|
|
738
845
|
- If "file" is a single URL, the file is downloaded from that URL and uploaded.
|
|
@@ -1366,7 +1473,7 @@ Output:
|
|
|
1366
1473
|
```
|
|
1367
1474
|
|
|
1368
1475
|
#### `getConnectorAction(serviceId, actionId)`
|
|
1369
|
-
Get the full configuration for a connector action, including all input fields needed to call it via `runFromConnectorRegistry`. Connectors are sourced from the open-source MindStudio Connector Registry (MSCR) with 850+ third-party
|
|
1476
|
+
Get the full configuration for a connector action, including all input fields needed to call it via `runFromConnectorRegistry`. Connectors are sourced from the open-source MindStudio Connector Registry (MSCR) with 850+ connector actions across third-party services.
|
|
1370
1477
|
|
|
1371
1478
|
Output:
|
|
1372
1479
|
```typescript
|
|
@@ -1394,3 +1501,57 @@ Output:
|
|
|
1394
1501
|
}[]
|
|
1395
1502
|
}
|
|
1396
1503
|
```
|
|
1504
|
+
|
|
1505
|
+
#### `estimateStepCost(stepType, step?, options?)`
|
|
1506
|
+
Estimate the cost of executing a step before running it. Pass the same step config you would use for execution.
|
|
1507
|
+
|
|
1508
|
+
```typescript
|
|
1509
|
+
const estimate = await agent.estimateStepCost('generateText', { message: 'Hello' });
|
|
1510
|
+
```
|
|
1511
|
+
|
|
1512
|
+
- `stepType`: string — The step method name (e.g. `"generateText"`).
|
|
1513
|
+
- `step`: object — Optional step input parameters for more accurate estimates.
|
|
1514
|
+
- `options`: `{ appId?: string, workflowId?: string }` — Optional context for pricing.
|
|
1515
|
+
|
|
1516
|
+
Output:
|
|
1517
|
+
```typescript
|
|
1518
|
+
{
|
|
1519
|
+
costType?: string; // "free" when the step has no cost
|
|
1520
|
+
estimates?: {
|
|
1521
|
+
eventType: string; // Billing event type
|
|
1522
|
+
label: string; // Human-readable cost label
|
|
1523
|
+
unitPrice: number; // Price per unit in billing units
|
|
1524
|
+
unitType: string; // What constitutes a unit (e.g. "token", "request")
|
|
1525
|
+
estimatedCost?: number; // Estimated total cost, or null if not estimable
|
|
1526
|
+
quantity: number; // Number of billable units
|
|
1527
|
+
}[]
|
|
1528
|
+
}
|
|
1529
|
+
```
|
|
1530
|
+
|
|
1531
|
+
#### `changeName(displayName)`
|
|
1532
|
+
Update the display name of the authenticated agent. Useful for agents to set their own name after connecting.
|
|
1533
|
+
|
|
1534
|
+
```typescript
|
|
1535
|
+
await agent.changeName('My Agent');
|
|
1536
|
+
```
|
|
1537
|
+
|
|
1538
|
+
#### `changeProfilePicture(profilePictureUrl)`
|
|
1539
|
+
Update the profile picture of the authenticated agent. Useful for agents to set their own avatar after connecting.
|
|
1540
|
+
|
|
1541
|
+
```typescript
|
|
1542
|
+
await agent.changeProfilePicture('https://example.com/avatar.png');
|
|
1543
|
+
```
|
|
1544
|
+
|
|
1545
|
+
#### `uploadFile(content, options)`
|
|
1546
|
+
Upload a file to the MindStudio CDN. Gets a signed upload URL, PUTs the file content, and returns the permanent public URL.
|
|
1547
|
+
|
|
1548
|
+
```typescript
|
|
1549
|
+
import { readFileSync } from 'fs';
|
|
1550
|
+
const { url } = await agent.uploadFile(readFileSync('photo.png'), { extension: 'png', type: 'image/png' });
|
|
1551
|
+
```
|
|
1552
|
+
|
|
1553
|
+
- `content`: `Buffer | Uint8Array` — The file content.
|
|
1554
|
+
- `options.extension`: string — File extension without the dot (e.g. `"png"`, `"jpg"`, `"mp4"`).
|
|
1555
|
+
- `options.type`: string (optional) — MIME type (e.g. `"image/png"`). Determines which CDN subdomain is used.
|
|
1556
|
+
|
|
1557
|
+
Output: `{ url: string }` — The permanent public CDN URL.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstudio-ai/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "TypeScript SDK for MindStudio direct step execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"dev": "tsup --watch",
|
|
26
26
|
"codegen": "tsx scripts/codegen.ts",
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
|
+
"postinstall": "node dist/postinstall.js || true",
|
|
28
29
|
"prepare": "npm run build",
|
|
29
30
|
"prepublishOnly": "npm run build"
|
|
30
31
|
},
|