@mindstudio-ai/agent 0.0.20 → 0.1.1

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/llms.txt CHANGED
@@ -1,9 +1,24 @@
1
1
  # @mindstudio-ai/agent
2
2
 
3
- TypeScript SDK, CLI, and MCP server for executing MindStudio workflow steps. Each method calls a specific AI/automation action and returns typed results.
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. **Discover** — Call `listSteps` (MCP tool) or `mindstudio list --summary` (CLI) to get a compact `{ method: description }` map of everything available (~3k tokens).
12
+ 2. **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.
13
+ 3. **Call it** — Invoke the method with the required parameters. All step methods share the same calling convention (see below).
14
+
15
+ For specific use cases:
16
+
17
+ - **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.
18
+ - **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.
19
+ - **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.
20
+ - **Cost estimation**: Call `estimateStepCost(stepType, stepInput)` before expensive calls to preview pricing.
21
+
7
22
  ## Install
8
23
 
9
24
  ```bash
@@ -26,7 +41,10 @@ mindstudio generate-image '{prompt: "A mountain landscape"}'
26
41
  # Extract a single output field
27
42
  mindstudio generate-image --prompt "A sunset" --output-key imageUrl
28
43
 
29
- # List all available methods
44
+ # List all methods (compact JSON — best for LLM discovery)
45
+ mindstudio list --summary
46
+
47
+ # List all methods (human-readable table)
30
48
  mindstudio list
31
49
 
32
50
  # Show method details (params, types, output)
@@ -57,7 +75,7 @@ Auth resolution order: `--api-key` flag > `MINDSTUDIO_API_KEY` env > `~/.mindstu
57
75
 
58
76
  ## MCP server
59
77
 
60
- The package includes an MCP server exposing all methods as tools:
78
+ The package includes an MCP server exposing all methods as tools. Start by calling the `listSteps` tool to discover available methods.
61
79
 
62
80
  ```bash
63
81
  mindstudio mcp
@@ -98,9 +116,9 @@ new MindStudioAgent({
98
116
 
99
117
  ## Models
100
118
 
101
- MindStudio provides access to models from many providers (OpenAI, Google, Anthropic, Meta, xAI, DeepSeek, etc.) through a single API key. You do NOT need provider-specific API keys.
119
+ Direct access to 200+ AI models from every major provider all through a single API key, billed at cost with no markups.
102
120
 
103
- Use `listModels()` or `listModelsByType("llm_chat")` to discover available models. Pass a model ID to `modelOverride.model` in methods like `generateText` to select a specific model:
121
+ Use `listModels()` or `listModelsByType()` for full model details, or `listModelsSummary()` / `listModelsSummaryByType()` for a lightweight list (id, name, type, tags) suitable for LLM context windows. Pass a model ID to `modelOverride.model` in methods like `generateText` to select a specific model:
104
122
 
105
123
  ```typescript
106
124
  const { models } = await agent.listModelsByType('llm_chat');
@@ -109,7 +127,7 @@ const model = models.find(m => m.name.includes("Gemini"));
109
127
  const { content } = await agent.generateText({
110
128
  message: 'Hello',
111
129
  modelOverride: {
112
- model: model.rawName,
130
+ model: model.id,
113
131
  temperature: 0.7,
114
132
  maxResponseTokens: 1024,
115
133
  },
@@ -227,6 +245,14 @@ Create a new empty vector data source for the current app.
227
245
  - Input: `{ name: string }`
228
246
  - Output: `unknown`
229
247
 
248
+ #### createGmailDraft
249
+ Create a draft email in the connected Gmail account.
250
+ - Requires a Google OAuth connection with Gmail compose scope.
251
+ - The draft appears in the user's Gmail Drafts folder but is not sent.
252
+ - messageType controls the body format: "plain" for plain text, "html" for raw HTML, "markdown" for auto-converted markdown.
253
+ - Input: `{ to: string, subject: string, message: string, connectionId?: string, messageType: "plain" | "html" | "markdown" }`
254
+ - Output: `{ draftId: string }`
255
+
230
256
  #### deleteDataSource
231
257
  Delete a vector data source from the current app.
232
258
  - Soft-deletes a data source (vector database) by marking it as deleted.
@@ -408,6 +434,23 @@ Generate a video from a text prompt using an AI model.
408
434
  - Input: `{ prompt: string, skipAssetCreation?: boolean, videoModelOverride?: { model: string, config?: object }, generateVariants?: boolean, numVariants?: number, addWatermark?: boolean }`
409
435
  - Output: `{ videoUrl: string | string[] }`
410
436
 
437
+ #### getGmailAttachments
438
+ Download attachments from a Gmail email and re-host them on CDN.
439
+ - Requires a Google OAuth connection with Gmail readonly scope.
440
+ - Attachments are uploaded to CDN and returned as URLs.
441
+ - Attachments larger than 25MB are skipped.
442
+ - Use the message ID from Search Gmail Emails, List Recent Gmail Emails, or Get Gmail Email steps.
443
+ - Input: `{ messageId: string, connectionId?: string }`
444
+ - Output: `unknown`
445
+
446
+ #### getGmailUnreadCount
447
+ Get the number of unread emails in the connected Gmail inbox.
448
+ - Requires a Google OAuth connection with Gmail readonly scope.
449
+ - Returns the unread message count for the inbox label.
450
+ - This is a lightweight call that does not fetch any email content.
451
+ - Input: `{ connectionId?: string }`
452
+ - Output: `unknown`
453
+
411
454
  #### getMediaMetadata
412
455
  Get info about a media file
413
456
  - Input: `{ mediaUrl: string }`
@@ -445,6 +488,22 @@ List all data sources for the current app.
445
488
  - Input: `object`
446
489
  - Output: `unknown`
447
490
 
491
+ #### listGmailLabels
492
+ List all labels in the connected Gmail account. Use these label IDs or names with the Update Gmail Labels step.
493
+ - Requires a Google OAuth connection with Gmail readonly scope.
494
+ - Returns both system labels (INBOX, SENT, TRASH, etc.) and user-created labels.
495
+ - Label type is "system" for built-in labels or "user" for custom labels.
496
+ - Input: `{ connectionId?: string }`
497
+ - Output: `unknown`
498
+
499
+ #### listRecentGmailEmails
500
+ List recent emails from the connected Gmail inbox.
501
+ - Requires a Google OAuth connection with Gmail readonly scope.
502
+ - Returns up to 100 emails (default 5), ordered by most recent first.
503
+ - Functionally equivalent to Search Gmail Emails with an "in:inbox" query.
504
+ - Input: `{ connectionId?: string, exportType: "json" | "text", limit: string }`
505
+ - Output: `unknown`
506
+
448
507
  #### logic
449
508
  Route execution to different branches based on AI evaluation, comparison operators, or workflow jumps.
450
509
  - Supports two modes: "ai" (default) uses an AI model to pick the most accurate statement; "comparison" uses operator-based checks.
@@ -541,6 +600,16 @@ Resize a video file
541
600
  - Input: `{ videoUrl: string, mode: "fit" | "exact", maxWidth?: number, maxHeight?: number, width?: number, height?: number, strategy?: "pad" | "crop", skipAssetCreation?: boolean }`
542
601
  - Output: `{ videoUrl: string }`
543
602
 
603
+ #### runFromConnectorRegistry
604
+ Run a raw API connector to a third-party service
605
+ - Use the /developer/v2/helpers/connectors endpoint to list available services and actions.
606
+ - Use /developer/v2/helpers/connectors/{serviceId}/{actionId} to get the full input configuration for an action.
607
+ - Use /developer/v2/helpers/connections to list your available OAuth connections.
608
+ - The actionId format is "serviceId/actionId" (e.g., "slack/send-message").
609
+ - Pass a __connectionId to authenticate the request with a specific OAuth connection, otherwise the default will be used (if configured).
610
+ - Input: `{ actionId: string, displayName: string, icon: string, configurationValues: object, __connectionId?: string }`
611
+ - Output: `{ data: object }`
612
+
544
613
  #### runPackagedWorkflow
545
614
  Run a packaged workflow ("custom block")
546
615
  - From the user's perspective, packaged workflows are just ordinary blocks. Behind the scenes, they operate like packages/libraries in a programming language, letting the user execute custom functionality.
@@ -585,6 +654,16 @@ Scrape public profile data from an X (Twitter) account by URL.
585
654
  - Input: `{ url: string }`
586
655
  - Output: `{ profile: { text: string, html: string, json?: object, screenshotUrl?: string, metadata?: { title: string, description: string, url: string, image: string } } }`
587
656
 
657
+ #### searchGmailEmails
658
+ Search for emails in the connected Gmail account using a Gmail search query. To list recent inbox emails, pass an empty query string.
659
+ - Requires a Google OAuth connection with Gmail readonly scope.
660
+ - Uses Gmail search syntax (e.g. "from:user@example.com", "subject:invoice", "is:unread").
661
+ - To list recent inbox emails, use an empty query string or "in:inbox".
662
+ - Returns up to 100 emails (default 5). The variable receives text or JSON depending on exportType.
663
+ - The direct execution output always returns structured email objects.
664
+ - Input: `{ query: string, connectionId?: string, exportType: "json" | "text", limit: string }`
665
+ - Output: `{ emails: { id: string, subject: string, from: string, to: string, date: string, plainBody: string, htmlBody: string, labels: string }[] }`
666
+
588
667
  #### searchGoogle
589
668
  Search the web using Google and return structured results.
590
669
  - Defaults to us/english, but can optionally specify country and/or language.
@@ -632,6 +711,21 @@ Send an email to one or more configured recipient addresses.
632
711
  - 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[] }`
633
712
  - Output: `{ recipients: string[] }`
634
713
 
714
+ #### sendGmailDraft
715
+ Send an existing draft from the connected Gmail account.
716
+ - Requires a Google OAuth connection with Gmail compose scope.
717
+ - The draft is sent and removed from the Drafts folder.
718
+ - Use the draft ID returned by the Create Gmail Draft or List Gmail Drafts steps.
719
+ - Input: `{ draftId: string, connectionId?: string }`
720
+ - Output: `unknown`
721
+
722
+ #### sendGmailMessage
723
+ Send an email from the connected Gmail account.
724
+ - Requires a Google OAuth connection with Gmail compose scope.
725
+ - messageType controls the body format: "plain" for plain text, "html" for raw HTML, "markdown" for auto-converted markdown.
726
+ - Input: `{ to: string, subject: string, message: string, connectionId?: string, messageType: "plain" | "html" | "markdown" }`
727
+ - Output: `{ messageId: string }`
728
+
635
729
  #### sendSMS
636
730
  Send an SMS or MMS message to a phone number configured via OAuth connection.
637
731
  - User is responsible for configuring the connection to the number (MindStudio requires double opt-in to prevent spam)
@@ -641,6 +735,14 @@ Send an SMS or MMS message to a phone number configured via OAuth connection.
641
735
  - Input: `{ body: string, connectionId?: string, mediaUrls?: string[] }`
642
736
  - Output: `unknown`
643
737
 
738
+ #### setGmailReadStatus
739
+ Mark one or more Gmail emails as read or unread.
740
+ - Requires a Google OAuth connection with Gmail modify scope.
741
+ - Accepts one or more message IDs as a comma-separated string or array.
742
+ - Set markAsRead to true to mark as read, false to mark as unread.
743
+ - Input: `{ messageIds: string, markAsRead: boolean, connectionId?: string }`
744
+ - Output: `unknown`
745
+
644
746
  #### setRunTitle
645
747
  Set the title of the agent run for the user's history
646
748
  - Input: `{ title: string }`
@@ -723,6 +825,14 @@ Trim an audio or video clip
723
825
  - Input: `{ inputUrl: string, start?: number | string, duration?: string | number, skipAssetCreation?: boolean }`
724
826
  - Output: `{ mediaUrl: string }`
725
827
 
828
+ #### updateGmailLabels
829
+ Add or remove labels on Gmail messages, identified by message IDs or a search query.
830
+ - Requires a Google OAuth connection with Gmail modify scope.
831
+ - Provide either a query (Gmail search syntax) or explicit messageIds to target messages.
832
+ - Label IDs can be label names or Gmail label IDs — names are resolved automatically.
833
+ - Input: `{ query: string, connectionId?: string, messageIds: string, addLabelIds: string, removeLabelIds: string }`
834
+ - Output: `{ updatedMessageIds: string[] }`
835
+
726
836
  #### uploadDataSourceDocument
727
837
  Upload a file into an existing data source from a URL or raw text content.
728
838
  - If "file" is a single URL, the file is downloaded from that URL and uploaded.
@@ -1292,12 +1402,10 @@ Output:
1292
1402
  models: {
1293
1403
  id: string;
1294
1404
  name: string; // Display name
1295
- rawName: string; // Full provider model identifier
1296
1405
  type: "llm_chat" | "image_generation" | "video_generation" | "video_analysis" | "text_to_speech" | "vision" | "transcription";
1297
- publisher: string;
1298
1406
  maxTemperature: number;
1299
1407
  maxResponseSize: number;
1300
- contextWindow: number;
1408
+ inputs: object[]; // Accepted input types
1301
1409
  }[]
1302
1410
  }
1303
1411
  ```
@@ -1307,12 +1415,39 @@ List AI models filtered by type.
1307
1415
  - `modelType`: `"llm_chat"` | `"image_generation"` | `"video_generation"` | `"video_analysis"` | `"text_to_speech"` | `"vision"` | `"transcription"`
1308
1416
  - Output: same as `listModels()`
1309
1417
 
1418
+ #### `listModelsSummary()`
1419
+ List all available AI models (summary). Returns only id, name, type, and tags. Suitable for display or consumption inside a model context window.
1420
+
1421
+ Output:
1422
+ ```typescript
1423
+ {
1424
+ models: {
1425
+ id: string;
1426
+ name: string;
1427
+ type: "llm_chat" | "image_generation" | "video_generation" | "video_analysis" | "text_to_speech" | "vision" | "transcription";
1428
+ tags: string; // Comma-separated tags
1429
+ }[]
1430
+ }
1431
+ ```
1432
+
1433
+ #### `listModelsSummaryByType(modelType)`
1434
+ List AI models (summary) filtered by type.
1435
+ - `modelType`: `"llm_chat"` | `"image_generation"` | `"video_generation"` | `"video_analysis"` | `"text_to_speech"` | `"vision"` | `"transcription"`
1436
+ - Output: same as `listModelsSummary()`
1437
+
1310
1438
  #### `listConnectors()`
1311
- List available connector services (Slack, Google, HubSpot, etc.).
1439
+ List available connector services (Slack, Google, HubSpot, etc.) and their actions.
1312
1440
 
1313
1441
  Output:
1314
1442
  ```typescript
1315
- { services: Array<{ service: object, actions: object[] }> }
1443
+ {
1444
+ services: {
1445
+ id: string;
1446
+ name: string;
1447
+ icon: string;
1448
+ actions: { id: string; name: string }[];
1449
+ }[]
1450
+ }
1316
1451
  ```
1317
1452
 
1318
1453
  #### `getConnector(serviceId)`
@@ -1320,5 +1455,68 @@ Get details for a single connector service by ID.
1320
1455
 
1321
1456
  Output:
1322
1457
  ```typescript
1323
- { service: object }
1458
+ {
1459
+ service: {
1460
+ id: string;
1461
+ name: string;
1462
+ icon: string;
1463
+ actions: { id: string; name: string }[];
1464
+ }
1465
+ }
1466
+ ```
1467
+
1468
+ #### `getConnectorAction(serviceId, actionId)`
1469
+ 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.
1470
+
1471
+ Output:
1472
+ ```typescript
1473
+ {
1474
+ action: {
1475
+ id: string;
1476
+ name: string;
1477
+ description: string;
1478
+ quickHelp: string;
1479
+ configuration: { title: string; items: { label: string; helpText: string; variable: string; type: string; defaultValue: string; placeholder: string; selectOptions?: object }[] }[];
1480
+ }
1481
+ }
1482
+ ```
1483
+
1484
+ #### `listConnections()`
1485
+ List OAuth connections for the organization. Use the returned connection IDs when calling connector actions. Connectors require the user to connect to the third-party service in MindStudio before they can be used.
1486
+
1487
+ Output:
1488
+ ```typescript
1489
+ {
1490
+ connections: {
1491
+ id: string; // Connection ID to pass to connector actions
1492
+ provider: string; // Integration provider (e.g. slack, google)
1493
+ name: string; // Display name or account identifier
1494
+ }[]
1495
+ }
1496
+ ```
1497
+
1498
+ #### `estimateStepCost(stepType, step?, options?)`
1499
+ Estimate the cost of executing a step before running it. Pass the same step config you would use for execution.
1500
+
1501
+ ```typescript
1502
+ const estimate = await agent.estimateStepCost('generateText', { message: 'Hello' });
1503
+ ```
1504
+
1505
+ - `stepType`: string — The step method name (e.g. `"generateText"`).
1506
+ - `step`: object — Optional step input parameters for more accurate estimates.
1507
+ - `options`: `{ appId?: string, workflowId?: string }` — Optional context for pricing.
1508
+
1509
+ Output:
1510
+ ```typescript
1511
+ {
1512
+ costType?: string; // "free" when the step has no cost
1513
+ estimates?: {
1514
+ eventType: string; // Billing event type
1515
+ label: string; // Human-readable cost label
1516
+ unitPrice: number; // Price per unit in billing units
1517
+ unitType: string; // What constitutes a unit (e.g. "token", "request")
1518
+ estimatedCost?: number; // Estimated total cost, or null if not estimable
1519
+ quantity: number; // Number of billable units
1520
+ }[]
1521
+ }
1324
1522
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.0.20",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript SDK for MindStudio direct step execution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",