@mastra/mcp-docs-server 1.1.35-alpha.6 → 1.1.35

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.
Files changed (111) hide show
  1. package/.docs/course/03-agent-memory/18-advanced-configuration-semantic-recall.md +48 -4
  2. package/.docs/docs/agents/background-tasks.md +62 -2
  3. package/.docs/docs/agents/processors.md +9 -1
  4. package/.docs/docs/agents/response-caching.md +148 -0
  5. package/.docs/docs/agents/signals.md +151 -0
  6. package/.docs/docs/agents/using-tools.md +8 -0
  7. package/.docs/docs/browser/agent-browser.md +15 -0
  8. package/.docs/docs/browser/stagehand.md +25 -1
  9. package/.docs/docs/editor/tools.md +1 -1
  10. package/.docs/docs/index.md +2 -2
  11. package/.docs/docs/mastra-platform/configuration.md +1 -1
  12. package/.docs/docs/mastra-platform/overview.md +1 -1
  13. package/.docs/docs/memory/observational-memory.md +61 -13
  14. package/.docs/docs/memory/semantic-recall.md +68 -6
  15. package/.docs/docs/observability/logging.md +2 -2
  16. package/.docs/docs/observability/metrics/overview.md +4 -4
  17. package/.docs/docs/observability/overview.md +6 -6
  18. package/.docs/docs/observability/tracing/bridges/otel.md +25 -0
  19. package/.docs/docs/observability/tracing/exporters/arize.md +5 -5
  20. package/.docs/docs/observability/tracing/exporters/braintrust.md +37 -0
  21. package/.docs/docs/observability/tracing/exporters/langfuse.md +21 -0
  22. package/.docs/docs/observability/tracing/exporters/{cloud.md → mastra-platform.md} +28 -26
  23. package/.docs/docs/observability/tracing/exporters/{default.md → mastra-storage.md} +56 -19
  24. package/.docs/docs/observability/tracing/exporters/otel.md +79 -2
  25. package/.docs/docs/observability/tracing/overview.md +30 -29
  26. package/.docs/docs/observability/tracing/processors/sensitive-data-filter.md +6 -6
  27. package/.docs/docs/server/mastra-server.md +30 -19
  28. package/.docs/docs/studio/observability.md +4 -4
  29. package/.docs/docs/studio/overview.md +6 -0
  30. package/.docs/docs/voice/overview.md +84 -0
  31. package/.docs/docs/workflows/suspend-and-resume.md +28 -1
  32. package/.docs/guides/deployment/inngest.md +23 -0
  33. package/.docs/guides/guide/web-search.md +7 -7
  34. package/.docs/guides/migrations/mastra-cloud.md +6 -6
  35. package/.docs/guides/migrations/upgrade-to-v1/tracing.md +19 -17
  36. package/.docs/models/gateways/azure-openai.md +94 -23
  37. package/.docs/models/gateways/netlify.md +2 -1
  38. package/.docs/models/gateways/openrouter.md +4 -1
  39. package/.docs/models/gateways/vercel.md +2 -1
  40. package/.docs/models/index.md +1 -1
  41. package/.docs/models/providers/chutes.md +23 -54
  42. package/.docs/models/providers/databricks.md +96 -0
  43. package/.docs/models/providers/deepseek.md +3 -1
  44. package/.docs/models/providers/digitalocean.md +9 -2
  45. package/.docs/models/providers/firepass.md +71 -0
  46. package/.docs/models/providers/google.md +3 -2
  47. package/.docs/models/providers/kilo.md +5 -3
  48. package/.docs/models/providers/llmgateway.md +7 -1
  49. package/.docs/models/providers/nebius.md +37 -55
  50. package/.docs/models/providers/novita-ai.md +5 -5
  51. package/.docs/models/providers/nvidia.md +59 -49
  52. package/.docs/models/providers/ollama-cloud.md +1 -1
  53. package/.docs/models/providers/openai.md +2 -0
  54. package/.docs/models/providers/opencode.md +44 -43
  55. package/.docs/models/providers/poe.md +4 -1
  56. package/.docs/models/providers/sarvam.md +72 -0
  57. package/.docs/models/providers/wafer.ai.md +2 -1
  58. package/.docs/models/providers/xiaomi-token-plan-ams.md +6 -5
  59. package/.docs/models/providers/xiaomi-token-plan-cn.md +6 -5
  60. package/.docs/models/providers/xiaomi-token-plan-sgp.md +6 -5
  61. package/.docs/models/providers.md +3 -1
  62. package/.docs/reference/agents/agent.md +85 -0
  63. package/.docs/reference/browser/agent-browser.md +37 -11
  64. package/.docs/reference/browser/stagehand-browser.md +35 -9
  65. package/.docs/reference/cli/mastra.md +497 -1
  66. package/.docs/reference/client-js/agents.md +115 -1
  67. package/.docs/reference/client-js/responses.md +4 -0
  68. package/.docs/reference/configuration.md +6 -6
  69. package/.docs/reference/editor/tool-provider.md +3 -3
  70. package/.docs/reference/harness/harness-class.md +21 -8
  71. package/.docs/reference/index.md +5 -0
  72. package/.docs/reference/memory/observational-memory.md +11 -1
  73. package/.docs/reference/observability/metrics/automatic-metrics.md +2 -4
  74. package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
  75. package/.docs/reference/observability/tracing/bridges/otel.md +26 -4
  76. package/.docs/reference/observability/tracing/configuration.md +6 -3
  77. package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
  78. package/.docs/reference/observability/tracing/exporters/braintrust.md +2 -0
  79. package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +3 -1
  80. package/.docs/reference/observability/tracing/exporters/console-exporter.md +2 -2
  81. package/.docs/reference/observability/tracing/exporters/default-exporter.md +7 -1
  82. package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +263 -0
  83. package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +194 -0
  84. package/.docs/reference/observability/tracing/exporters/otel.md +12 -8
  85. package/.docs/reference/observability/tracing/instances.md +2 -2
  86. package/.docs/reference/observability/tracing/interfaces.md +37 -2
  87. package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +22 -0
  88. package/.docs/reference/observability/tracing/span-filtering.md +2 -2
  89. package/.docs/reference/processors/prefill-error-handler.md +3 -3
  90. package/.docs/reference/processors/response-cache.md +114 -0
  91. package/.docs/reference/processors/tool-call-filter.md +28 -0
  92. package/.docs/reference/storage/clickhouse.md +8 -8
  93. package/.docs/reference/storage/cloudflare-d1.md +1 -1
  94. package/.docs/reference/storage/cloudflare.md +1 -1
  95. package/.docs/reference/storage/composite.md +1 -1
  96. package/.docs/reference/storage/convex.md +1 -1
  97. package/.docs/reference/storage/dsql.md +428 -0
  98. package/.docs/reference/storage/duckdb.md +3 -3
  99. package/.docs/reference/storage/dynamodb.md +1 -1
  100. package/.docs/reference/storage/lance.md +1 -1
  101. package/.docs/reference/storage/libsql.md +1 -1
  102. package/.docs/reference/storage/postgresql.md +1 -1
  103. package/.docs/reference/storage/upstash.md +1 -1
  104. package/.docs/reference/streaming/ChunkType.md +44 -0
  105. package/.docs/reference/streaming/agents/stream.md +18 -2
  106. package/.docs/reference/tools/brightdata.md +167 -0
  107. package/.docs/reference/tools/create-tool.md +46 -0
  108. package/.docs/reference/voice/inworld.md +133 -0
  109. package/.docs/reference/workflows/workflow-state-reader.md +113 -0
  110. package/CHANGELOG.md +113 -0
  111. package/package.json +6 -6
@@ -464,10 +464,42 @@ mastra auth tokens revoke <token-id>
464
464
 
465
465
  ## `mastra lint`
466
466
 
467
- The `mastra lint` command validates the structure and code of your Mastra project to ensure it follows best practices and is error-free.
467
+ The `mastra lint` command validates the structure and code of your Mastra project.
468
+
469
+ By default, `mastra lint` runs project checks against your source files and configuration. Use `--preflight` to also run bundle checks against `.mastra/output` before deployment.
470
+
471
+ ```bash
472
+ mastra lint --preflight
473
+ ```
468
474
 
469
475
  It accepts [common flags](#common-flags).
470
476
 
477
+ ### Flags
478
+
479
+ #### `--preflight`
480
+
481
+ Runs deployment preflight checks against the built Mastra output. This builds the project before checking it unless you also pass `--skip-build`.
482
+
483
+ #### `--skip-build`
484
+
485
+ Skips the build step and reuses the existing `.mastra/output` directory. This flag only applies when `--preflight` is set.
486
+
487
+ #### `--env-file <file>`
488
+
489
+ Uses the specified environment file for preflight validation. This flag only applies when `--preflight` is set.
490
+
491
+ #### `--strict`
492
+
493
+ Treats warnings as errors.
494
+
495
+ #### `--json`
496
+
497
+ Emits machine-readable JSON output.
498
+
499
+ #### `--debug`
500
+
501
+ Enables debug logs.
502
+
471
503
  ## `mastra scorers`
472
504
 
473
505
  The `mastra scorers` command provides management capabilities for evaluation scorers that measure the quality, accuracy, and performance of AI-generated outputs.
@@ -550,6 +582,470 @@ See the [Storage migration guide](https://mastra.ai/guides/migrations/upgrade-to
550
582
 
551
583
  It accepts [common flags](#common-flags).
552
584
 
585
+ ## `mastra api`
586
+
587
+ Calls a Mastra runtime server with JSON input and JSON output. Use it for local development servers, deployed Mastra Platform projects, or self-hosted Mastra servers.
588
+
589
+ ```bash
590
+ mastra api agent list --pretty
591
+ mastra api agent run weather-agent '{"messages":"What is the weather in London?"}'
592
+ mastra api tool execute get-weather '{"location":"San Francisco"}'
593
+ ```
594
+
595
+ Use `mastra api <resource> <action> --help` to see examples for a command.
596
+
597
+ ### Output
598
+
599
+ Success responses are written to `stdout` as JSON. Single-resource commands return:
600
+
601
+ ```json
602
+ { "data": {} }
603
+ ```
604
+
605
+ List commands return a `data` array and pagination metadata:
606
+
607
+ ```json
608
+ { "data": [], "page": { "total": 0, "page": 0, "perPage": 0, "hasMore": false } }
609
+ ```
610
+
611
+ Errors are written to `stderr` as JSON and return a non-zero exit code:
612
+
613
+ ```json
614
+ {
615
+ "error": {
616
+ "code": "SERVER_UNREACHABLE",
617
+ "message": "Could not connect to target server",
618
+ "details": {}
619
+ }
620
+ }
621
+ ```
622
+
623
+ ### Target resolution
624
+
625
+ The command resolves the target server in this order:
626
+
627
+ 1. `--url <url>` for an explicit remote or self-hosted server.
628
+ 2. `http://localhost:4111` for a local `mastra dev` server.
629
+ 3. `.mastra-project.json` for a Mastra Platform project.
630
+
631
+ Automatic platform auth is only used when the CLI resolves a Mastra Platform target from `.mastra-project.json`. Localhost targets and explicit `--url` targets do not receive automatic credentials. Headers passed with `--header` are sent to any target, including localhost.
632
+
633
+ ### Flags
634
+
635
+ #### `--url <url>`
636
+
637
+ Target a specific Mastra server URL.
638
+
639
+ ```bash
640
+ mastra api --url https://example.com agent list
641
+ ```
642
+
643
+ #### `--header <"Key: Value">`
644
+
645
+ Send a custom HTTP header. Repeat the flag to send multiple headers.
646
+
647
+ ```bash
648
+ mastra api --url https://example.com --header "Authorization: Bearer $TOKEN" agent list
649
+ ```
650
+
651
+ #### `--timeout <ms>`
652
+
653
+ Set the request timeout in milliseconds. Defaults to `30000`. Workflow run start and resume commands default to `120000`.
654
+
655
+ #### `--pretty`
656
+
657
+ Pretty-print JSON output. Defaults to `false`.
658
+
659
+ #### `--schema`
660
+
661
+ Print the CLI-oriented request schema for a command that accepts JSON input. The schema comes from the target server's route contracts and includes the command shape, positionals, examples, request schemas, and response shape.
662
+
663
+ `--schema` is available on leaf commands that accept JSON input. It is not available as a top-level `mastra api` flag.
664
+
665
+ ```bash
666
+ mastra api agent run --schema
667
+ mastra api tool execute --schema
668
+ ```
669
+
670
+ ### Input model
671
+
672
+ Commands that accept input take one inline JSON argument. Do not pass file paths or stdin.
673
+
674
+ ```bash
675
+ mastra api workflow run start data-pipeline '{"inputData":{"source":"s3://bucket/data.csv"}}'
676
+ ```
677
+
678
+ Use positional arguments for stable IDs and JSON for filters or payloads. For routes that require both query parameters and a request body, pass one JSON object. The CLI splits the input according to the server route schema.
679
+
680
+ ```bash
681
+ mastra api thread create '{"agentId":"weather-agent","resourceId":"user_123","threadId":"thread_abc123","title":"Support conversation"}'
682
+ ```
683
+
684
+ List commands accept `page` and `perPage` in the JSON input when the target route supports pagination:
685
+
686
+ ```bash
687
+ mastra api score list '{"page":0,"perPage":50}'
688
+ ```
689
+
690
+ ### Get command-specific help
691
+
692
+ Each `mastra api` leaf command includes command-specific examples in its help output. Use `--help` on the exact command you want to call:
693
+
694
+ ```bash
695
+ mastra api agent run --help
696
+ mastra api tool execute --help
697
+ mastra api memory current update --help
698
+ mastra api workflow run resume --help
699
+ ```
700
+
701
+ Use `--schema` on commands that accept JSON input to inspect the request shape returned by the target server:
702
+
703
+ ```bash
704
+ mastra api agent run --schema
705
+ mastra api thread create --schema
706
+ mastra api score create --schema
707
+ ```
708
+
709
+ Some commands have important runtime requirements. For example, `mastra api memory current update` requires working memory to be enabled for the memory instance, and `mastra api workflow run resume` only works for suspended workflow runs.
710
+
711
+ ### Commands
712
+
713
+ #### `mastra api agent list`
714
+
715
+ Lists the agents registered on the target server. Pass optional JSON input for route-supported filters.
716
+
717
+ ```bash
718
+ mastra api agent list [input]
719
+ ```
720
+
721
+ #### `mastra api agent get`
722
+
723
+ Gets metadata for one registered agent.
724
+
725
+ ```bash
726
+ mastra api agent get <agentId>
727
+ ```
728
+
729
+ #### `mastra api agent run`
730
+
731
+ Runs an agent with JSON input. Use command help to see examples for text prompts, chat messages, and memory thread options.
732
+
733
+ ```bash
734
+ mastra api agent run <agentId> <input>
735
+ ```
736
+
737
+ #### `mastra api workflow list`
738
+
739
+ Lists workflows registered on the target server. Pass optional JSON input for route-supported filters.
740
+
741
+ ```bash
742
+ mastra api workflow list [input]
743
+ ```
744
+
745
+ #### `mastra api workflow get`
746
+
747
+ Gets metadata for one registered workflow.
748
+
749
+ ```bash
750
+ mastra api workflow get <workflowId>
751
+ ```
752
+
753
+ #### `mastra api workflow run start`
754
+
755
+ Starts a workflow run with JSON input. Workflow start commands use a longer default timeout than most commands because runs can take longer to complete.
756
+
757
+ ```bash
758
+ mastra api workflow run start <workflowId> <input>
759
+ ```
760
+
761
+ #### `mastra api workflow run list`
762
+
763
+ Lists runs for a workflow. Pass optional JSON input for route-supported filters or pagination.
764
+
765
+ ```bash
766
+ mastra api workflow run list <workflowId> [input]
767
+ ```
768
+
769
+ #### `mastra api workflow run get`
770
+
771
+ Gets one workflow run by ID.
772
+
773
+ ```bash
774
+ mastra api workflow run get <workflowId> <runId>
775
+ ```
776
+
777
+ #### `mastra api workflow run resume`
778
+
779
+ Resumes a suspended workflow run with JSON input. The run must be in a suspended state.
780
+
781
+ ```bash
782
+ mastra api workflow run resume <workflowId> <runId> <input>
783
+ ```
784
+
785
+ #### `mastra api workflow run cancel`
786
+
787
+ Cancels a workflow run.
788
+
789
+ ```bash
790
+ mastra api workflow run cancel <workflowId> <runId>
791
+ ```
792
+
793
+ #### `mastra api tool list`
794
+
795
+ Lists tools registered on the target server. Pass optional JSON input for route-supported filters.
796
+
797
+ ```bash
798
+ mastra api tool list [input]
799
+ ```
800
+
801
+ #### `mastra api tool get`
802
+
803
+ Gets metadata and schemas for one tool.
804
+
805
+ ```bash
806
+ mastra api tool get <toolId>
807
+ ```
808
+
809
+ #### `mastra api tool execute`
810
+
811
+ Executes a tool with JSON input. Raw tool input is wrapped as the route `data` field unless you pass an explicit `data` object.
812
+
813
+ ```bash
814
+ mastra api tool execute <toolId> <input>
815
+ ```
816
+
817
+ #### `mastra api mcp list`
818
+
819
+ Lists Model Context Protocol (MCP) servers registered on the target server. Pass optional JSON input for route-supported filters.
820
+
821
+ ```bash
822
+ mastra api mcp list [input]
823
+ ```
824
+
825
+ #### `mastra api mcp get`
826
+
827
+ Gets metadata for one MCP server.
828
+
829
+ ```bash
830
+ mastra api mcp get <id>
831
+ ```
832
+
833
+ #### `mastra api mcp tool list`
834
+
835
+ Lists tools exposed by an MCP server. Pass optional JSON input for route-supported filters.
836
+
837
+ ```bash
838
+ mastra api mcp tool list <serverId> [input]
839
+ ```
840
+
841
+ #### `mastra api mcp tool get`
842
+
843
+ Gets metadata and schemas for one MCP tool.
844
+
845
+ ```bash
846
+ mastra api mcp tool get <serverId> <toolId>
847
+ ```
848
+
849
+ #### `mastra api mcp tool execute`
850
+
851
+ Executes an MCP tool with JSON input. Raw tool input is wrapped as the route `data` field unless you pass an explicit `data` object.
852
+
853
+ ```bash
854
+ mastra api mcp tool execute <serverId> <toolId> <input>
855
+ ```
856
+
857
+ #### `mastra api thread list`
858
+
859
+ Lists memory threads. Pass optional JSON input for route-supported filters.
860
+
861
+ ```bash
862
+ mastra api thread list [input]
863
+ ```
864
+
865
+ #### `mastra api thread get`
866
+
867
+ Gets one memory thread by ID.
868
+
869
+ ```bash
870
+ mastra api thread get <threadId>
871
+ ```
872
+
873
+ #### `mastra api thread create`
874
+
875
+ Creates a memory thread. Pass one JSON input object; the CLI splits fields such as `agentId` into query parameters when required by the server route.
876
+
877
+ ```bash
878
+ mastra api thread create <input>
879
+ ```
880
+
881
+ #### `mastra api thread update`
882
+
883
+ Updates a memory thread. Pass one JSON input object for fields such as `agentId`, `resourceId`, `title`, or `metadata`.
884
+
885
+ ```bash
886
+ mastra api thread update <threadId> <input>
887
+ ```
888
+
889
+ #### `mastra api thread delete`
890
+
891
+ Deletes a memory thread. Pass JSON input for route-required query parameters such as `agentId` and `resourceId`.
892
+
893
+ ```bash
894
+ mastra api thread delete <threadId> <input>
895
+ ```
896
+
897
+ #### `mastra api thread messages`
898
+
899
+ Lists messages for a memory thread. Pass optional JSON input for route-supported filters or pagination.
900
+
901
+ ```bash
902
+ mastra api thread messages <threadId> [input]
903
+ ```
904
+
905
+ #### `mastra api memory search`
906
+
907
+ Searches long-term memory. Use `--help` or `--schema` to inspect required fields such as `agentId`, `resourceId`, and `searchQuery`.
908
+
909
+ ```bash
910
+ mastra api memory search <input>
911
+ ```
912
+
913
+ #### `mastra api memory current get`
914
+
915
+ Reads current working memory for a thread.
916
+
917
+ ```bash
918
+ mastra api memory current get <input>
919
+ ```
920
+
921
+ #### `mastra api memory current update`
922
+
923
+ Updates current working memory for a thread. Working memory must be enabled for the memory instance.
924
+
925
+ ```bash
926
+ mastra api memory current update <input>
927
+ ```
928
+
929
+ #### `mastra api memory status`
930
+
931
+ Gets memory status for an agent and optional thread or resource context.
932
+
933
+ ```bash
934
+ mastra api memory status <input>
935
+ ```
936
+
937
+ #### `mastra api trace list`
938
+
939
+ Lists observability traces. Pass optional JSON input for route-supported filters or pagination.
940
+
941
+ ```bash
942
+ mastra api trace list [input]
943
+ ```
944
+
945
+ #### `mastra api trace get`
946
+
947
+ Gets one observability trace by ID.
948
+
949
+ ```bash
950
+ mastra api trace get <traceId>
951
+ ```
952
+
953
+ #### `mastra api log list`
954
+
955
+ Lists observability logs. Pass optional JSON input for route-supported filters or pagination.
956
+
957
+ ```bash
958
+ mastra api log list [input]
959
+ ```
960
+
961
+ #### `mastra api score create`
962
+
963
+ Creates an observability score. The input uses the server score body shape; inspect it with `--schema`.
964
+
965
+ ```bash
966
+ mastra api score create <input>
967
+ ```
968
+
969
+ #### `mastra api score list`
970
+
971
+ Lists observability scores. Pass optional JSON input for filters such as run ID or pagination.
972
+
973
+ ```bash
974
+ mastra api score list [input]
975
+ ```
976
+
977
+ #### `mastra api score get`
978
+
979
+ Gets one observability score by ID.
980
+
981
+ ```bash
982
+ mastra api score get <scoreId>
983
+ ```
984
+
985
+ #### `mastra api dataset list`
986
+
987
+ Lists datasets. Pass optional JSON input for route-supported filters or pagination.
988
+
989
+ ```bash
990
+ mastra api dataset list [input]
991
+ ```
992
+
993
+ #### `mastra api dataset get`
994
+
995
+ Gets one dataset by ID.
996
+
997
+ ```bash
998
+ mastra api dataset get <datasetId>
999
+ ```
1000
+
1001
+ #### `mastra api dataset create`
1002
+
1003
+ Creates a dataset with JSON input.
1004
+
1005
+ ```bash
1006
+ mastra api dataset create <input>
1007
+ ```
1008
+
1009
+ #### `mastra api dataset items`
1010
+
1011
+ Lists items in a dataset. Pass optional JSON input for route-supported filters or pagination.
1012
+
1013
+ ```bash
1014
+ mastra api dataset items <datasetId> [input]
1015
+ ```
1016
+
1017
+ #### `mastra api experiment list`
1018
+
1019
+ Lists experiments for a dataset. Pass optional JSON input for route-supported filters or pagination.
1020
+
1021
+ ```bash
1022
+ mastra api experiment list <datasetId> [input]
1023
+ ```
1024
+
1025
+ #### `mastra api experiment get`
1026
+
1027
+ Gets one experiment by ID.
1028
+
1029
+ ```bash
1030
+ mastra api experiment get <datasetId> <experimentId>
1031
+ ```
1032
+
1033
+ #### `mastra api experiment run`
1034
+
1035
+ Starts an experiment for a dataset with JSON input.
1036
+
1037
+ ```bash
1038
+ mastra api experiment run <datasetId> <input>
1039
+ ```
1040
+
1041
+ #### `mastra api experiment results`
1042
+
1043
+ Lists results for an experiment. Pass optional JSON input for route-supported filters or pagination.
1044
+
1045
+ ```bash
1046
+ mastra api experiment results <datasetId> <experimentId> [input]
1047
+ ```
1048
+
553
1049
  ## Common flags
554
1050
 
555
1051
  ### `--dir`
@@ -151,6 +151,95 @@ for await (const part of uiMessageStream) {
151
151
  }
152
152
  ```
153
153
 
154
+ ### `sendSignal()`
155
+
156
+ Send a signal to an active agent run or memory thread. Use this with `subscribeToThread()` so the client can render the stream that wakes from, or receives, the signal.
157
+
158
+ ```typescript
159
+ const agent = mastraClient.getAgent('support-agent')
160
+
161
+ const result = await agent.sendSignal({
162
+ signal: {
163
+ type: 'user-message',
164
+ contents: 'Also consider the customer note I just added.',
165
+ },
166
+ resourceId: 'user-123',
167
+ threadId: 'thread-abc',
168
+ })
169
+
170
+ console.log(result.runId)
171
+ ```
172
+
173
+ Use `ifActive.behavior` and `ifIdle.behavior` to control whether Mastra delivers, persists, discards, or wakes from a signal:
174
+
175
+ ```typescript
176
+ await agent.sendSignal({
177
+ signal: { type: 'user-message', contents: 'Store this for later.' },
178
+ resourceId: 'user-123',
179
+ threadId: 'thread-abc',
180
+ ifIdle: {
181
+ behavior: 'persist',
182
+ },
183
+ })
184
+ ```
185
+
186
+ Pass `ifIdle.streamOptions` when the idle wake-up stream needs options such as model settings, tools, or runtime context:
187
+
188
+ ```typescript
189
+ await agent.sendSignal({
190
+ signal: { type: 'user-message', contents: 'Start from this signal.' },
191
+ resourceId: 'user-123',
192
+ threadId: 'thread-abc',
193
+ ifIdle: {
194
+ behavior: 'wake',
195
+ streamOptions: {
196
+ maxSteps: 3,
197
+ },
198
+ },
199
+ })
200
+ ```
201
+
202
+ Returns `{ accepted: true, runId: string }`.
203
+
204
+ **signal** (`{ type: 'user-message'; contents: MessageListInput } | { type: string; contents: string }`): \`user-message\` signals are treated as user input. Other signal types are converted to contextual XML before the next model call.
205
+
206
+ **runId** (`string`): Run ID to target directly.
207
+
208
+ **resourceId** (`string`): Resource ID for the memory thread. Use with \`threadId\` for thread-targeted signals.
209
+
210
+ **threadId** (`string`): Thread ID to target. Use with \`resourceId\` for thread-targeted signals.
211
+
212
+ **ifActive.behavior** (`'deliver' | 'persist' | 'discard'`): Controls what happens when the target thread is active. Defaults to \`deliver\`.
213
+
214
+ **ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): Controls what happens when the target thread is idle. Defaults to \`wake\`.
215
+
216
+ **ifIdle.streamOptions** (`Omit<AgentExecutionOptions, 'messages'>`): Options for the stream that starts when \`ifIdle.behavior\` is \`wake\`.
217
+
218
+ ### `subscribeToThread()`
219
+
220
+ Subscribe to raw stream chunks for a memory thread. Use this to render output from a thread that may be started or continued by `sendSignal()`.
221
+
222
+ ```typescript
223
+ const agent = mastraClient.getAgent('support-agent')
224
+
225
+ const subscription = await agent.subscribeToThread({
226
+ resourceId: 'user-123',
227
+ threadId: 'thread-abc',
228
+ })
229
+
230
+ await subscription.processDataStream({
231
+ onChunk: async chunk => {
232
+ console.log(chunk)
233
+ },
234
+ })
235
+ ```
236
+
237
+ `subscribeToThread()` returns the underlying `Response` plus a `processDataStream()` helper. The helper reads the subscription stream until the connection closes or the request is aborted.
238
+
239
+ **resourceId** (`string`): Resource ID for the memory thread.
240
+
241
+ **threadId** (`string`): Thread ID to subscribe to.
242
+
154
243
  ### `streamUntilIdle()`
155
244
 
156
245
  Stream a response and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. The server re-enters the agentic loop on each task completion so the LLM can react to results in the same call. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `stream()`.
@@ -161,7 +250,7 @@ const response = await agent.streamUntilIdle('Research solana for me', {
161
250
  thread: 'thread-1',
162
251
  resource: 'resource-1',
163
252
  },
164
- maxIdleMs: 5 * 60_000,
253
+ maxIdleMs: 5 * 60_000, //optional
165
254
  })
166
255
 
167
256
  response.processDataStream({
@@ -173,6 +262,31 @@ response.processDataStream({
173
262
  })
174
263
  ```
175
264
 
265
+ ### `resumeStreamUntilIdle()`
266
+
267
+ Resume a suspended agent stream with custom data and keep the stream open until every [background task](https://mastra.ai/docs/agents/background-tasks) dispatched during the run completes. Use this to continue execution after a suspension point, such as a workflow suspend within an agent. Requires background tasks to be [enabled on the Mastra instance](https://mastra.ai/reference/configuration) and a memory thread; otherwise the call falls through to a plain `resumeStream()`:
268
+
269
+ ```typescript
270
+ const response = await agent.resumeStreamUntilIdle(
271
+ { approved: true, selectedOption: 'plan-b' },
272
+ {
273
+ memory: {
274
+ thread: 'thread-1',
275
+ resource: 'resource-1',
276
+ },
277
+ runId: 'run-123',
278
+ toolCallId: 'tool-call-456', // optional
279
+ maxIdleMs: 5 * 60_000, //optional
280
+ },
281
+ )
282
+
283
+ await response.processDataStream({
284
+ onChunk: chunk => {
285
+ console.log(chunk)
286
+ },
287
+ })
288
+ ```
289
+
176
290
  The stream emits the same chunk types as `stream()`, plus `background-task-*` chunks for task lifecycle events. Visit [`Agent.streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) for the full server-side API and [background task chunks](https://mastra.ai/reference/streaming/ChunkType) for the payload shapes.
177
291
 
178
292
  ### `getTool()`
@@ -59,6 +59,8 @@ for await (const event of stream) {
59
59
  }
60
60
  ```
61
61
 
62
+ Streaming responses can also include tool events. Tool-call streams use `response.output_item.added`, `response.function_call_arguments.delta`, `response.function_call_arguments.done`, and `response.output_item.done` events. Tool results appear as `function_call_output` items with `<toolCallId>:output` IDs.
63
+
62
64
  **Returns:** `Promise<ResponsesStream>`.
63
65
 
64
66
  #### `retrieve(responseId, requestContext?)`
@@ -130,6 +132,8 @@ Use [`client.conversations`](https://mastra.ai/reference/client-js/conversations
130
132
 
131
133
  If the model calls a function, that activity appears in `response.output` as `function_call` and `function_call_output` items alongside the final assistant `message`.
132
134
 
135
+ When `stream: true`, function calls are also emitted as Responses stream events. Read `response.function_call_arguments.delta` events for partial argument chunks and prefer `response.function_call_arguments.done` for the finalized arguments payload and tool name. Read `response.output_item.done` events for completed `function_call` and `function_call_output` items. Tool output items use `<toolCallId>:output` IDs.
136
+
133
137
  ## Structured output
134
138
 
135
139
  Use `text.format` when you want JSON output.
@@ -175,20 +175,20 @@ Custom ID generator function for creating unique identifiers. Mastra passes opti
175
175
  > **Warning:** This is used internally by Mastra for creating IDs for workflow runs, agent conversations, and other resources. Most users won't need to configure this option.
176
176
 
177
177
  ```typescript
178
+ import { v4 as uuid } from '@lukeed/uuid'
178
179
  import { Mastra } from '@mastra/core'
179
- import { nanoid } from 'nanoid'
180
180
 
181
181
  export const mastra = new Mastra({
182
182
  idGenerator: context => {
183
183
  if (context?.idType === 'message' && context?.threadId) {
184
- return `msg-${context.threadId}-${nanoid(8)}`
184
+ return `msg-${context.threadId}-${uuid()}`
185
185
  }
186
186
 
187
187
  if (context?.idType === 'run' && context?.source && context?.entityId) {
188
- return `${context.source}-run-${context.entityId}-${nanoid(6)}`
188
+ return `${context.source}-run-${context.entityId}-${uuid()}`
189
189
  }
190
190
 
191
- return nanoid()
191
+ return uuid()
192
192
  },
193
193
  })
194
194
  ```
@@ -277,7 +277,7 @@ Visit the [Observability documentation](https://mastra.ai/docs/observability/ove
277
277
  ```typescript
278
278
  import { Mastra } from '@mastra/core'
279
279
  import { LibSQLStore } from '@mastra/libsql'
280
- import { Observability, DefaultExporter } from '@mastra/observability'
280
+ import { Observability, MastraStorageExporter } from '@mastra/observability'
281
281
 
282
282
  export const mastra = new Mastra({
283
283
  storage: new LibSQLStore({
@@ -288,7 +288,7 @@ export const mastra = new Mastra({
288
288
  configs: {
289
289
  default: {
290
290
  serviceName: 'my-app',
291
- exporters: [new DefaultExporter()],
291
+ exporters: [new MastraStorageExporter()],
292
292
  },
293
293
  },
294
294
  }),