@mastra/client-js 0.12.3 → 0.12.4-alpha.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.12.4-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Playground ui -pass runtimeContext to client SDK get methods ([#7767](https://github.com/mastra-ai/mastra/pull/7767))
8
+
9
+ - Improve client-js SDK agent and workflow APIs ([#7592](https://github.com/mastra-ai/mastra/pull/7592))
10
+
11
+ - Dedicated client-js SDK createTool without server dependencies ([#7781](https://github.com/mastra-ai/mastra/pull/7781))
12
+
13
+ - Updated dependencies [[`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11)]:
14
+ - @mastra/core@0.16.4-alpha.0
15
+
3
16
  ## 0.12.3
4
17
 
5
18
  ### Patch Changes
package/dist/client.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare class MastraClient extends BaseResource {
10
10
  constructor(options: ClientOptions);
11
11
  /**
12
12
  * Retrieves all available agents
13
- * @param runtimeContext - Runtime context to use for the agents
13
+ * @param runtimeContext - Optional runtime context to pass as query parameter
14
14
  * @returns Promise containing map of agent IDs to agent details
15
15
  */
16
16
  getAgents(runtimeContext?: RuntimeContext | Record<string, any>): Promise<Record<string, GetAgentResponse>>;
@@ -84,9 +84,10 @@ export declare class MastraClient extends BaseResource {
84
84
  }>;
85
85
  /**
86
86
  * Retrieves all available tools
87
+ * @param runtimeContext - Optional runtime context to pass as query parameter
87
88
  * @returns Promise containing map of tool IDs to tool details
88
89
  */
89
- getTools(): Promise<Record<string, GetToolResponse>>;
90
+ getTools(runtimeContext?: RuntimeContext | Record<string, any>): Promise<Record<string, GetToolResponse>>;
90
91
  /**
91
92
  * Gets a tool instance by ID
92
93
  * @param toolId - ID of the tool to retrieve
@@ -106,9 +107,10 @@ export declare class MastraClient extends BaseResource {
106
107
  getLegacyWorkflow(workflowId: string): LegacyWorkflow;
107
108
  /**
108
109
  * Retrieves all available workflows
110
+ * @param runtimeContext - Optional runtime context to pass as query parameter
109
111
  * @returns Promise containing map of workflow IDs to workflow details
110
112
  */
111
- getWorkflows(): Promise<Record<string, GetWorkflowResponse>>;
113
+ getWorkflows(runtimeContext?: RuntimeContext | Record<string, any>): Promise<Record<string, GetWorkflowResponse>>;
112
114
  /**
113
115
  * Gets a workflow instance by ID
114
116
  * @param workflowId - ID of the workflow to retrieve
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,OAAO,EACP,GAAG,EACH,OAAO,EACP,cAAc,EACd,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,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imeContext) {
27
27
  }
28
28
  return void 0;
29
29
  }
30
+ function runtimeContextQueryString(runtimeContext) {
31
+ const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
32
+ if (!runtimeContextParam) return "";
33
+ const searchParams = new URLSearchParams();
34
+ searchParams.set("runtimeContext", runtimeContextParam);
35
+ const queryString = searchParams.toString();
36
+ return queryString ? `?${queryString}` : "";
37
+ }
30
38
  function isZodType(value) {
31
39
  return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
32
40
  }
@@ -286,30 +294,20 @@ var AgentVoice = class extends BaseResource {
286
294
  /**
287
295
  * Get available speakers for the agent's voice provider
288
296
  * @param runtimeContext - Optional runtime context to pass as query parameter
297
+ * @param runtimeContext - Optional runtime context to pass as query parameter
289
298
  * @returns Promise containing list of available speakers
290
299
  */
291
300
  getSpeakers(runtimeContext) {
292
- const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
293
- const searchParams = new URLSearchParams();
294
- if (runtimeContextParam) {
295
- searchParams.set("runtimeContext", runtimeContextParam);
296
- }
297
- const queryString = searchParams.toString();
298
- return this.request(`/api/agents/${this.agentId}/voice/speakers${queryString ? `?${queryString}` : ""}`);
301
+ return this.request(`/api/agents/${this.agentId}/voice/speakers${runtimeContextQueryString(runtimeContext)}`);
299
302
  }
300
303
  /**
301
304
  * Get the listener configuration for the agent's voice provider
302
305
  * @param runtimeContext - Optional runtime context to pass as query parameter
306
+ * @param runtimeContext - Optional runtime context to pass as query parameter
303
307
  * @returns Promise containing a check if the agent has listening capabilities
304
308
  */
305
309
  getListener(runtimeContext) {
306
- const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
307
- const searchParams = new URLSearchParams();
308
- if (runtimeContextParam) {
309
- searchParams.set("runtimeContext", runtimeContextParam);
310
- }
311
- const queryString = searchParams.toString();
312
- return this.request(`/api/agents/${this.agentId}/voice/listener${queryString ? `?${queryString}` : ""}`);
310
+ return this.request(`/api/agents/${this.agentId}/voice/listener${runtimeContextQueryString(runtimeContext)}`);
313
311
  }
314
312
  };
315
313
  var Agent = class extends BaseResource {
@@ -321,17 +319,11 @@ var Agent = class extends BaseResource {
321
319
  voice;
322
320
  /**
323
321
  * Retrieves details about the agent
324
- * @param runtimeContext - Runtime context to use for the agent
322
+ * @param runtimeContext - Optional runtime context to pass as query parameter
325
323
  * @returns Promise containing agent details including model and instructions
326
324
  */
327
325
  details(runtimeContext) {
328
- const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
329
- const searchParams = new URLSearchParams();
330
- if (runtimeContextParam) {
331
- searchParams.set("runtimeContext", runtimeContextParam);
332
- }
333
- const queryString = searchParams.toString();
334
- return this.request(`/api/agents/${this.agentId}${queryString ? `?${queryString}` : ""}`);
326
+ return this.request(`/api/agents/${this.agentId}${runtimeContextQueryString(runtimeContext)}`);
335
327
  }
336
328
  async generate(params) {
337
329
  console.warn(
@@ -404,7 +396,16 @@ var Agent = class extends BaseResource {
404
396
  }
405
397
  return response;
406
398
  }
407
- async generateVNext(params) {
399
+ async generateVNext(messagesOrParams, options) {
400
+ let params;
401
+ if (typeof messagesOrParams === "object" && "messages" in messagesOrParams) {
402
+ params = messagesOrParams;
403
+ } else {
404
+ params = {
405
+ messages: messagesOrParams,
406
+ ...options
407
+ };
408
+ }
408
409
  const processedParams = {
409
410
  ...params,
410
411
  output: params.output ? zodToJsonSchema(params.output) : void 0,
@@ -1133,7 +1134,16 @@ var Agent = class extends BaseResource {
1133
1134
  };
1134
1135
  return streamResponse;
1135
1136
  }
1136
- async streamVNext(params) {
1137
+ async streamVNext(messagesOrParams, options) {
1138
+ let params;
1139
+ if (typeof messagesOrParams === "object" && "messages" in messagesOrParams) {
1140
+ params = messagesOrParams;
1141
+ } else {
1142
+ params = {
1143
+ messages: messagesOrParams,
1144
+ ...options
1145
+ };
1146
+ }
1137
1147
  const processedParams = {
1138
1148
  ...params,
1139
1149
  output: params.output ? zodToJsonSchema(params.output) : void 0,
@@ -1282,13 +1292,7 @@ var Agent = class extends BaseResource {
1282
1292
  * @returns Promise containing tool details
1283
1293
  */
1284
1294
  getTool(toolId, runtimeContext) {
1285
- const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
1286
- const searchParams = new URLSearchParams();
1287
- if (runtimeContextParam) {
1288
- searchParams.set("runtimeContext", runtimeContextParam);
1289
- }
1290
- const queryString = searchParams.toString();
1291
- return this.request(`/api/agents/${this.agentId}/tools/${toolId}${queryString ? `?${queryString}` : ""}`);
1295
+ return this.request(`/api/agents/${this.agentId}/tools/${toolId}${runtimeContextQueryString(runtimeContext)}`);
1292
1296
  }
1293
1297
  /**
1294
1298
  * Executes a tool for the agent
@@ -1312,13 +1316,7 @@ var Agent = class extends BaseResource {
1312
1316
  * @returns Promise containing agent evaluations
1313
1317
  */
1314
1318
  evals(runtimeContext) {
1315
- const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
1316
- const searchParams = new URLSearchParams();
1317
- if (runtimeContextParam) {
1318
- searchParams.set("runtimeContext", runtimeContextParam);
1319
- }
1320
- const queryString = searchParams.toString();
1321
- return this.request(`/api/agents/${this.agentId}/evals/ci${queryString ? `?${queryString}` : ""}`);
1319
+ return this.request(`/api/agents/${this.agentId}/evals/ci${runtimeContextQueryString(runtimeContext)}`);
1322
1320
  }
1323
1321
  /**
1324
1322
  * Retrieves live evaluation results for the agent
@@ -1326,13 +1324,7 @@ var Agent = class extends BaseResource {
1326
1324
  * @returns Promise containing live agent evaluations
1327
1325
  */
1328
1326
  liveEvals(runtimeContext) {
1329
- const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
1330
- const searchParams = new URLSearchParams();
1331
- if (runtimeContextParam) {
1332
- searchParams.set("runtimeContext", runtimeContextParam);
1333
- }
1334
- const queryString = searchParams.toString();
1335
- return this.request(`/api/agents/${this.agentId}/evals/live${queryString ? `?${queryString}` : ""}`);
1327
+ return this.request(`/api/agents/${this.agentId}/evals/live${runtimeContextQueryString(runtimeContext)}`);
1336
1328
  }
1337
1329
  /**
1338
1330
  * Updates the model for the agent
@@ -1353,10 +1345,11 @@ var Network = class extends BaseResource {
1353
1345
  }
1354
1346
  /**
1355
1347
  * Retrieves details about the network
1348
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1356
1349
  * @returns Promise containing network details
1357
1350
  */
1358
- details() {
1359
- return this.request(`/api/networks/${this.networkId}`);
1351
+ details(runtimeContext) {
1352
+ return this.request(`/api/networks/${this.networkId}${runtimeContextQueryString(runtimeContext)}`);
1360
1353
  }
1361
1354
  /**
1362
1355
  * Generates a response from the agent
@@ -1490,10 +1483,13 @@ var Vector = class extends BaseResource {
1490
1483
  /**
1491
1484
  * Retrieves details about a specific vector index
1492
1485
  * @param indexName - Name of the index to get details for
1486
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1493
1487
  * @returns Promise containing vector index details
1494
1488
  */
1495
- details(indexName) {
1496
- return this.request(`/api/vector/${this.vectorName}/indexes/${indexName}`);
1489
+ details(indexName, runtimeContext) {
1490
+ return this.request(
1491
+ `/api/vector/${this.vectorName}/indexes/${indexName}${runtimeContextQueryString(runtimeContext)}`
1492
+ );
1497
1493
  }
1498
1494
  /**
1499
1495
  * Deletes a vector index
@@ -1507,10 +1503,11 @@ var Vector = class extends BaseResource {
1507
1503
  }
1508
1504
  /**
1509
1505
  * Retrieves a list of all available indexes
1506
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1510
1507
  * @returns Promise containing array of index names
1511
1508
  */
1512
- getIndexes() {
1513
- return this.request(`/api/vector/${this.vectorName}/indexes`);
1509
+ getIndexes(runtimeContext) {
1510
+ return this.request(`/api/vector/${this.vectorName}/indexes${runtimeContextQueryString(runtimeContext)}`);
1514
1511
  }
1515
1512
  /**
1516
1513
  * Creates a new vector index
@@ -1556,17 +1553,20 @@ var LegacyWorkflow = class extends BaseResource {
1556
1553
  }
1557
1554
  /**
1558
1555
  * Retrieves details about the legacy workflow
1556
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1559
1557
  * @returns Promise containing legacy workflow details including steps and graphs
1560
1558
  */
1561
- details() {
1562
- return this.request(`/api/workflows/legacy/${this.workflowId}`);
1559
+ details(runtimeContext) {
1560
+ return this.request(`/api/workflows/legacy/${this.workflowId}${runtimeContextQueryString(runtimeContext)}`);
1563
1561
  }
1564
1562
  /**
1565
1563
  * Retrieves all runs for a legacy workflow
1566
1564
  * @param params - Parameters for filtering runs
1565
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1567
1566
  * @returns Promise containing legacy workflow runs array
1568
1567
  */
1569
- runs(params) {
1568
+ runs(params, runtimeContext) {
1569
+ const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
1570
1570
  const searchParams = new URLSearchParams();
1571
1571
  if (params?.fromDate) {
1572
1572
  searchParams.set("fromDate", params.fromDate.toISOString());
@@ -1583,6 +1583,9 @@ var LegacyWorkflow = class extends BaseResource {
1583
1583
  if (params?.resourceId) {
1584
1584
  searchParams.set("resourceId", params.resourceId);
1585
1585
  }
1586
+ if (runtimeContextParam) {
1587
+ searchParams.set("runtimeContext", runtimeContextParam);
1588
+ }
1586
1589
  if (searchParams.size) {
1587
1590
  return this.request(`/api/workflows/legacy/${this.workflowId}/runs?${searchParams}`);
1588
1591
  } else {
@@ -1736,10 +1739,11 @@ var Tool = class extends BaseResource {
1736
1739
  }
1737
1740
  /**
1738
1741
  * Retrieves details about the tool
1742
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1739
1743
  * @returns Promise containing tool details including description and schemas
1740
1744
  */
1741
- details() {
1742
- return this.request(`/api/tools/${this.toolId}`);
1745
+ details(runtimeContext) {
1746
+ return this.request(`/api/tools/${this.toolId}${runtimeContextQueryString(runtimeContext)}`);
1743
1747
  }
1744
1748
  /**
1745
1749
  * Executes the tool with the provided parameters
@@ -1816,17 +1820,20 @@ var Workflow = class extends BaseResource {
1816
1820
  }
1817
1821
  /**
1818
1822
  * Retrieves details about the workflow
1823
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1819
1824
  * @returns Promise containing workflow details including steps and graphs
1820
1825
  */
1821
- details() {
1822
- return this.request(`/api/workflows/${this.workflowId}`);
1826
+ details(runtimeContext) {
1827
+ return this.request(`/api/workflows/${this.workflowId}${runtimeContextQueryString(runtimeContext)}`);
1823
1828
  }
1824
1829
  /**
1825
1830
  * Retrieves all runs for a workflow
1826
1831
  * @param params - Parameters for filtering runs
1832
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1827
1833
  * @returns Promise containing workflow runs array
1828
1834
  */
1829
- runs(params) {
1835
+ runs(params, runtimeContext) {
1836
+ const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
1830
1837
  const searchParams = new URLSearchParams();
1831
1838
  if (params?.fromDate) {
1832
1839
  searchParams.set("fromDate", params.fromDate.toISOString());
@@ -1843,6 +1850,9 @@ var Workflow = class extends BaseResource {
1843
1850
  if (params?.resourceId) {
1844
1851
  searchParams.set("resourceId", params.resourceId);
1845
1852
  }
1853
+ if (runtimeContextParam) {
1854
+ searchParams.set("runtimeContext", runtimeContextParam);
1855
+ }
1846
1856
  if (searchParams.size) {
1847
1857
  return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
1848
1858
  } else {
@@ -1852,18 +1862,22 @@ var Workflow = class extends BaseResource {
1852
1862
  /**
1853
1863
  * Retrieves a specific workflow run by its ID
1854
1864
  * @param runId - The ID of the workflow run to retrieve
1865
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1855
1866
  * @returns Promise containing the workflow run details
1856
1867
  */
1857
- runById(runId) {
1858
- return this.request(`/api/workflows/${this.workflowId}/runs/${runId}`);
1868
+ runById(runId, runtimeContext) {
1869
+ return this.request(`/api/workflows/${this.workflowId}/runs/${runId}${runtimeContextQueryString(runtimeContext)}`);
1859
1870
  }
1860
1871
  /**
1861
1872
  * Retrieves the execution result for a specific workflow run by its ID
1862
1873
  * @param runId - The ID of the workflow run to retrieve the execution result for
1874
+ * @param runtimeContext - Optional runtime context to pass as query parameter
1863
1875
  * @returns Promise containing the workflow run execution result
1864
1876
  */
1865
- runExecutionResult(runId) {
1866
- return this.request(`/api/workflows/${this.workflowId}/runs/${runId}/execution-result`);
1877
+ runExecutionResult(runId, runtimeContext) {
1878
+ return this.request(
1879
+ `/api/workflows/${this.workflowId}/runs/${runId}/execution-result${runtimeContextQueryString(runtimeContext)}`
1880
+ );
1867
1881
  }
1868
1882
  /**
1869
1883
  * Cancels a specific workflow run by its ID
@@ -1891,14 +1905,40 @@ var Workflow = class extends BaseResource {
1891
1905
  * @param params - Optional object containing the optional runId
1892
1906
  * @returns Promise containing the runId of the created run
1893
1907
  */
1894
- createRun(params) {
1908
+ /** @deprecated Use createRunAsync instead */
1909
+ async createRun(params) {
1895
1910
  const searchParams = new URLSearchParams();
1896
1911
  if (!!params?.runId) {
1897
1912
  searchParams.set("runId", params.runId);
1898
1913
  }
1899
- return this.request(`/api/workflows/${this.workflowId}/create-run?${searchParams.toString()}`, {
1900
- method: "POST"
1901
- });
1914
+ const res = await this.request(
1915
+ `/api/workflows/${this.workflowId}/create-run?${searchParams.toString()}`,
1916
+ {
1917
+ method: "POST"
1918
+ }
1919
+ );
1920
+ const runId = res.runId;
1921
+ return {
1922
+ runId,
1923
+ start: async (p) => {
1924
+ return this.start({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
1925
+ },
1926
+ startAsync: async (p) => {
1927
+ return this.startAsync({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
1928
+ },
1929
+ watch: async (onRecord) => {
1930
+ return this.watch({ runId }, onRecord);
1931
+ },
1932
+ stream: async (p) => {
1933
+ return this.stream({ runId, inputData: p.inputData, runtimeContext: p.runtimeContext });
1934
+ },
1935
+ resume: async (p) => {
1936
+ return this.resume({ runId, step: p.step, resumeData: p.resumeData, runtimeContext: p.runtimeContext });
1937
+ },
1938
+ resumeAsync: async (p) => {
1939
+ return this.resumeAsync({ runId, step: p.step, resumeData: p.resumeData, runtimeContext: p.runtimeContext });
1940
+ }
1941
+ };
1902
1942
  }
1903
1943
  /**
1904
1944
  * Creates a new workflow run (alias for createRun)
@@ -1934,7 +1974,6 @@ var Workflow = class extends BaseResource {
1934
1974
  const runtimeContext = parseClientRuntimeContext(rest.runtimeContext);
1935
1975
  return this.request(`/api/workflows/${this.workflowId}/resume?runId=${runId}`, {
1936
1976
  method: "POST",
1937
- stream: true,
1938
1977
  body: {
1939
1978
  step,
1940
1979
  resumeData,
@@ -2210,10 +2249,11 @@ var MCPTool = class extends BaseResource {
2210
2249
  }
2211
2250
  /**
2212
2251
  * Retrieves details about this specific tool from the MCP server.
2252
+ * @param runtimeContext - Optional runtime context to pass as query parameter
2213
2253
  * @returns Promise containing the tool's information (name, description, schema).
2214
2254
  */
2215
- details() {
2216
- return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}`);
2255
+ details(runtimeContext) {
2256
+ return this.request(`/api/mcp/${this.serverId}/tools/${this.toolId}${runtimeContextQueryString(runtimeContext)}`);
2217
2257
  }
2218
2258
  /**
2219
2259
  * Executes this specific tool on the MCP server.
@@ -2724,10 +2764,11 @@ var VNextNetwork = class extends BaseResource {
2724
2764
  }
2725
2765
  /**
2726
2766
  * Retrieves details about the network
2767
+ * @param runtimeContext - Optional runtime context to pass as query parameter
2727
2768
  * @returns Promise containing vNext network details
2728
2769
  */
2729
- details() {
2730
- return this.request(`/api/networks/v-next/${this.networkId}`);
2770
+ details(runtimeContext) {
2771
+ return this.request(`/api/networks/v-next/${this.networkId}${runtimeContextQueryString(runtimeContext)}`);
2731
2772
  }
2732
2773
  /**
2733
2774
  * Generates a response from the v-next network
@@ -2862,7 +2903,7 @@ var MastraClient = class extends BaseResource {
2862
2903
  }
2863
2904
  /**
2864
2905
  * Retrieves all available agents
2865
- * @param runtimeContext - Runtime context to use for the agents
2906
+ * @param runtimeContext - Optional runtime context to pass as query parameter
2866
2907
  * @returns Promise containing map of agent IDs to agent details
2867
2908
  */
2868
2909
  getAgents(runtimeContext) {
@@ -2968,10 +3009,17 @@ var MastraClient = class extends BaseResource {
2968
3009
  }
2969
3010
  /**
2970
3011
  * Retrieves all available tools
3012
+ * @param runtimeContext - Optional runtime context to pass as query parameter
2971
3013
  * @returns Promise containing map of tool IDs to tool details
2972
3014
  */
2973
- getTools() {
2974
- return this.request("/api/tools");
3015
+ getTools(runtimeContext) {
3016
+ const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
3017
+ const searchParams = new URLSearchParams();
3018
+ if (runtimeContextParam) {
3019
+ searchParams.set("runtimeContext", runtimeContextParam);
3020
+ }
3021
+ const queryString = searchParams.toString();
3022
+ return this.request(`/api/tools${queryString ? `?${queryString}` : ""}`);
2975
3023
  }
2976
3024
  /**
2977
3025
  * Gets a tool instance by ID
@@ -2998,10 +3046,17 @@ var MastraClient = class extends BaseResource {
2998
3046
  }
2999
3047
  /**
3000
3048
  * Retrieves all available workflows
3049
+ * @param runtimeContext - Optional runtime context to pass as query parameter
3001
3050
  * @returns Promise containing map of workflow IDs to workflow details
3002
3051
  */
3003
- getWorkflows() {
3004
- return this.request("/api/workflows");
3052
+ getWorkflows(runtimeContext) {
3053
+ const runtimeContextParam = base64RuntimeContext(parseClientRuntimeContext(runtimeContext));
3054
+ const searchParams = new URLSearchParams();
3055
+ if (runtimeContextParam) {
3056
+ searchParams.set("runtimeContext", runtimeContextParam);
3057
+ }
3058
+ const queryString = searchParams.toString();
3059
+ return this.request(`/api/workflows${queryString ? `?${queryString}` : ""}`);
3005
3060
  }
3006
3061
  /**
3007
3062
  * Gets a workflow instance by ID
@@ -3383,6 +3438,27 @@ var MastraClient = class extends BaseResource {
3383
3438
  }
3384
3439
  };
3385
3440
 
3441
+ // src/tools.ts
3442
+ var ClientTool = class {
3443
+ id;
3444
+ description;
3445
+ inputSchema;
3446
+ outputSchema;
3447
+ execute;
3448
+ constructor(opts) {
3449
+ this.id = opts.id;
3450
+ this.description = opts.description;
3451
+ this.inputSchema = opts.inputSchema;
3452
+ this.outputSchema = opts.outputSchema;
3453
+ this.execute = opts.execute;
3454
+ }
3455
+ };
3456
+ function createTool(opts) {
3457
+ return new ClientTool(opts);
3458
+ }
3459
+
3460
+ exports.ClientTool = ClientTool;
3386
3461
  exports.MastraClient = MastraClient;
3462
+ exports.createTool = createTool;
3387
3463
  //# sourceMappingURL=index.cjs.map
3388
3464
  //# sourceMappingURL=index.cjs.map