@mindstudio-ai/agent 0.1.0 → 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 MindStudio. One API key gives you access to 200+ AI models (OpenAI, Anthropic, Google, Meta, xAI, DeepSeek, etc.) and 1,000+ integrations including 850+ third-party connectors from the open-source MindStudio Connector Registry (https://github.com/mindstudio-ai/mscr). No separate provider API keys required.
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
@@ -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.
@@ -595,6 +654,16 @@ Scrape public profile data from an X (Twitter) account by URL.
595
654
  - Input: `{ url: string }`
596
655
  - Output: `{ profile: { text: string, html: string, json?: object, screenshotUrl?: string, metadata?: { title: string, description: string, url: string, image: string } } }`
597
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
+
598
667
  #### searchGoogle
599
668
  Search the web using Google and return structured results.
600
669
  - Defaults to us/english, but can optionally specify country and/or language.
@@ -642,6 +711,21 @@ Send an email to one or more configured recipient addresses.
642
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[] }`
643
712
  - Output: `{ recipients: string[] }`
644
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
+
645
729
  #### sendSMS
646
730
  Send an SMS or MMS message to a phone number configured via OAuth connection.
647
731
  - User is responsible for configuring the connection to the number (MindStudio requires double opt-in to prevent spam)
@@ -651,6 +735,14 @@ Send an SMS or MMS message to a phone number configured via OAuth connection.
651
735
  - Input: `{ body: string, connectionId?: string, mediaUrls?: string[] }`
652
736
  - Output: `unknown`
653
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
+
654
746
  #### setRunTitle
655
747
  Set the title of the agent run for the user's history
656
748
  - Input: `{ title: string }`
@@ -733,6 +825,14 @@ Trim an audio or video clip
733
825
  - Input: `{ inputUrl: string, start?: number | string, duration?: string | number, skipAssetCreation?: boolean }`
734
826
  - Output: `{ mediaUrl: string }`
735
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
+
736
836
  #### uploadDataSourceDocument
737
837
  Upload a file into an existing data source from a URL or raw text content.
738
838
  - If "file" is a single URL, the file is downloaded from that URL and uploaded.
@@ -1366,7 +1466,7 @@ Output:
1366
1466
  ```
1367
1467
 
1368
1468
  #### `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 service integrations.
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.
1370
1470
 
1371
1471
  Output:
1372
1472
  ```typescript
@@ -1394,3 +1494,29 @@ Output:
1394
1494
  }[]
1395
1495
  }
1396
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
+ }
1522
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/agent",
3
- "version": "0.1.0",
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",