@mastra/client-js 1.17.0-alpha.2 → 1.17.0-alpha.4

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/dist/index.js CHANGED
@@ -3505,6 +3505,37 @@ var Observability = class extends BaseResource {
3505
3505
  const queryString = toQueryParams(params, ["filters", "pagination", "orderBy"]);
3506
3506
  return this.request(`/observability/traces${queryString ? `?${queryString}` : ""}`);
3507
3507
  }
3508
+ /**
3509
+ * Retrieves a paginated list of trace branches with optional filtering and sorting.
3510
+ *
3511
+ * Each row is a single branch-anchor span (e.g., AGENT_RUN, WORKFLOW_RUN, TOOL_CALL),
3512
+ * including ones nested under a different root entity. Use this to list every run of
3513
+ * a given agent/workflow/tool regardless of how it was triggered. Pairs with
3514
+ * {@link getBranch} to expand a single branch into its subtree.
3515
+ *
3516
+ * @param params - Parameters for pagination, filtering, and ordering
3517
+ * @returns Promise containing paginated branch-anchor spans and pagination info
3518
+ */
3519
+ listBranches(params = {}) {
3520
+ const queryString = toQueryParams(params, ["filters", "pagination", "orderBy"]);
3521
+ return this.request(`/observability/branches${queryString ? `?${queryString}` : ""}`);
3522
+ }
3523
+ /**
3524
+ * Retrieves the subtree of spans rooted at a given span.
3525
+ *
3526
+ * @param params - Parameters containing trace ID, span ID, and optional depth.
3527
+ * When `depth` is omitted the full descendant subtree is returned; with a finite
3528
+ * `depth` only that many levels below the anchor are returned (depth: 0 → only the
3529
+ * anchor span; depth: 1 → anchor plus immediate children; etc).
3530
+ * @returns Promise containing the branch (anchor span plus descendants)
3531
+ */
3532
+ getBranch(params) {
3533
+ const { traceId, spanId, depth } = params;
3534
+ const queryString = depth !== void 0 ? `?depth=${depth}` : "";
3535
+ return this.request(
3536
+ `/observability/traces/${encodeURIComponent(traceId)}/branches/${encodeURIComponent(spanId)}${queryString}`
3537
+ );
3538
+ }
3508
3539
  /**
3509
3540
  * Retrieves scores by trace ID and span ID
3510
3541
  * @param params - Parameters containing trace ID, span ID, and pagination options
@@ -5221,6 +5252,27 @@ var MastraClient = class extends BaseResource {
5221
5252
  getMcpServerTool(serverId, toolId) {
5222
5253
  return new MCPTool(this.options, serverId, toolId);
5223
5254
  }
5255
+ /**
5256
+ * Lists resources available on an MCP server.
5257
+ * @param serverId - The ID of the MCP server.
5258
+ * @returns Promise containing the list of resources.
5259
+ */
5260
+ getMcpServerResources(serverId) {
5261
+ return this.request(`/mcp/${encodeURIComponent(serverId)}/resources`);
5262
+ }
5263
+ /**
5264
+ * Reads the content of a resource from an MCP server.
5265
+ * Used for fetching ui:// MCP App HTML content.
5266
+ * @param serverId - The ID of the MCP server.
5267
+ * @param uri - The resource URI to read.
5268
+ * @returns Promise containing the resource content.
5269
+ */
5270
+ readMcpServerResource(serverId, uri) {
5271
+ return this.request(`/mcp/${encodeURIComponent(serverId)}/resources/read`, {
5272
+ method: "POST",
5273
+ body: { uri }
5274
+ });
5275
+ }
5224
5276
  /**
5225
5277
  * Gets an A2A client for interacting with an agent via the A2A protocol
5226
5278
  * @param agentId - ID of the agent to interact with
@@ -5410,6 +5462,22 @@ var MastraClient = class extends BaseResource {
5410
5462
  listTraces(params = {}) {
5411
5463
  return this.observability.listTraces(params);
5412
5464
  }
5465
+ /**
5466
+ * Retrieves a paginated list of trace branches with optional filtering and sorting.
5467
+ * Each row is a branch-anchor span (AGENT_RUN, WORKFLOW_RUN, TOOL_CALL, etc.) including
5468
+ * ones nested under a different root entity. Pairs with {@link getBranch} to expand
5469
+ * a single branch into its subtree.
5470
+ */
5471
+ listBranches(params = {}) {
5472
+ return this.observability.listBranches(params);
5473
+ }
5474
+ /**
5475
+ * Retrieves the subtree of spans rooted at a given span. The optional `depth` field
5476
+ * bounds descendant levels below the anchor (0 = anchor only; omitted = full subtree).
5477
+ */
5478
+ getBranch(params) {
5479
+ return this.observability.getBranch(params);
5480
+ }
5413
5481
  listScoresBySpan(params) {
5414
5482
  return this.observability.listScoresBySpan(params);
5415
5483
  }