@iqai/adk 0.1.3 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iqai/adk
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e68c31: Adds sampling handler for mcp-simplified-syntax
8
+
3
9
  ## 0.1.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1500,6 +1500,38 @@ declare function createSamplingHandler(handler: SamplingHandler): SamplingHandle
1500
1500
  * tools: [...atpTools, ...fraxlendTools],
1501
1501
  * });
1502
1502
  * ```
1503
+ *
1504
+ * @example
1505
+ * ```typescript
1506
+ * // Using MCP servers with sampling handlers:
1507
+ * import { createSamplingHandler, LlmResponse } from "@iqai/adk";
1508
+ *
1509
+ * const samplingHandler = createSamplingHandler(async (request) => {
1510
+ * // Handle MCP sampling requests
1511
+ * return new LlmResponse({
1512
+ * content: {
1513
+ * role: "model",
1514
+ * parts: [{ text: "Response from sampling handler" }],
1515
+ * },
1516
+ * });
1517
+ * });
1518
+ *
1519
+ * const nearTools = await McpNearAgent({
1520
+ * env: {
1521
+ * ACCOUNT_ID: env.ACCOUNT_ID,
1522
+ * ACCOUNT_KEY: env.ACCOUNT_KEY,
1523
+ * NEAR_NETWORK_ID: "testnet",
1524
+ * PATH: env.PATH
1525
+ * },
1526
+ * samplingHandler
1527
+ * }).getTools();
1528
+ *
1529
+ * const agent = new LlmAgent({
1530
+ * name: "near_assistant",
1531
+ * model: "gemini-2.5-flash",
1532
+ * tools: nearTools,
1533
+ * });
1534
+ * ```
1503
1535
  */
1504
1536
  /**
1505
1537
  * Base configuration interface for MCP servers
@@ -1516,6 +1548,8 @@ interface McpServerConfig {
1516
1548
  maxRetries?: number;
1517
1549
  initialDelay?: number;
1518
1550
  };
1551
+ /** Sampling handler for processing MCP sampling requests */
1552
+ samplingHandler?: SamplingHandler;
1519
1553
  }
1520
1554
  /**
1521
1555
  * MCP ABI - Smart contract ABI interactions for Ethereum-compatible blockchains
@@ -1594,7 +1628,7 @@ declare function McpMemory(config?: McpServerConfig): McpToolset;
1594
1628
  * Generic MCP server function for any package
1595
1629
  *
1596
1630
  * @param packageName The npm package name of the MCP server
1597
- * @param config Configuration object with environment variables
1631
+ * @param config Configuration object with environment variables and optional sampling handler
1598
1632
  * @param name Optional custom name for the client
1599
1633
  */
1600
1634
  declare function McpGeneric(packageName: string, config?: McpServerConfig, name?: string): McpToolset;
package/dist/index.d.ts CHANGED
@@ -1500,6 +1500,38 @@ declare function createSamplingHandler(handler: SamplingHandler): SamplingHandle
1500
1500
  * tools: [...atpTools, ...fraxlendTools],
1501
1501
  * });
1502
1502
  * ```
1503
+ *
1504
+ * @example
1505
+ * ```typescript
1506
+ * // Using MCP servers with sampling handlers:
1507
+ * import { createSamplingHandler, LlmResponse } from "@iqai/adk";
1508
+ *
1509
+ * const samplingHandler = createSamplingHandler(async (request) => {
1510
+ * // Handle MCP sampling requests
1511
+ * return new LlmResponse({
1512
+ * content: {
1513
+ * role: "model",
1514
+ * parts: [{ text: "Response from sampling handler" }],
1515
+ * },
1516
+ * });
1517
+ * });
1518
+ *
1519
+ * const nearTools = await McpNearAgent({
1520
+ * env: {
1521
+ * ACCOUNT_ID: env.ACCOUNT_ID,
1522
+ * ACCOUNT_KEY: env.ACCOUNT_KEY,
1523
+ * NEAR_NETWORK_ID: "testnet",
1524
+ * PATH: env.PATH
1525
+ * },
1526
+ * samplingHandler
1527
+ * }).getTools();
1528
+ *
1529
+ * const agent = new LlmAgent({
1530
+ * name: "near_assistant",
1531
+ * model: "gemini-2.5-flash",
1532
+ * tools: nearTools,
1533
+ * });
1534
+ * ```
1503
1535
  */
1504
1536
  /**
1505
1537
  * Base configuration interface for MCP servers
@@ -1516,6 +1548,8 @@ interface McpServerConfig {
1516
1548
  maxRetries?: number;
1517
1549
  initialDelay?: number;
1518
1550
  };
1551
+ /** Sampling handler for processing MCP sampling requests */
1552
+ samplingHandler?: SamplingHandler;
1519
1553
  }
1520
1554
  /**
1521
1555
  * MCP ABI - Smart contract ABI interactions for Ethereum-compatible blockchains
@@ -1594,7 +1628,7 @@ declare function McpMemory(config?: McpServerConfig): McpToolset;
1594
1628
  * Generic MCP server function for any package
1595
1629
  *
1596
1630
  * @param packageName The npm package name of the MCP server
1597
- * @param config Configuration object with environment variables
1631
+ * @param config Configuration object with environment variables and optional sampling handler
1598
1632
  * @param name Optional custom name for the client
1599
1633
  */
1600
1634
  declare function McpGeneric(packageName: string, config?: McpServerConfig, name?: string): McpToolset;
package/dist/index.js CHANGED
@@ -5177,7 +5177,13 @@ var McpToolAdapter = (_class18 = class extends BaseTool {
5177
5177
 
5178
5178
  // src/tools/mcp/servers.ts
5179
5179
  function createMcpConfig(name, packageName, config = {}) {
5180
- const { debug, description, retryOptions, env: envVars = {} } = config;
5180
+ const {
5181
+ debug,
5182
+ description,
5183
+ retryOptions,
5184
+ env: envVars = {},
5185
+ samplingHandler
5186
+ } = config;
5181
5187
  const env = {};
5182
5188
  for (const [key, value] of Object.entries(envVars)) {
5183
5189
  if (value !== void 0) {
@@ -5197,7 +5203,8 @@ function createMcpConfig(name, packageName, config = {}) {
5197
5203
  command: "npx",
5198
5204
  args: ["-y", packageName],
5199
5205
  env
5200
- }
5206
+ },
5207
+ samplingHandler
5201
5208
  };
5202
5209
  }
5203
5210
  function McpAbi(config = {}) {
package/dist/index.mjs CHANGED
@@ -5177,7 +5177,13 @@ var McpToolAdapter = class extends BaseTool {
5177
5177
 
5178
5178
  // src/tools/mcp/servers.ts
5179
5179
  function createMcpConfig(name, packageName, config = {}) {
5180
- const { debug, description, retryOptions, env: envVars = {} } = config;
5180
+ const {
5181
+ debug,
5182
+ description,
5183
+ retryOptions,
5184
+ env: envVars = {},
5185
+ samplingHandler
5186
+ } = config;
5181
5187
  const env = {};
5182
5188
  for (const [key, value] of Object.entries(envVars)) {
5183
5189
  if (value !== void 0) {
@@ -5197,7 +5203,8 @@ function createMcpConfig(name, packageName, config = {}) {
5197
5203
  command: "npx",
5198
5204
  args: ["-y", packageName],
5199
5205
  env
5200
- }
5206
+ },
5207
+ samplingHandler
5201
5208
  };
5202
5209
  }
5203
5210
  function McpAbi(config = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iqai/adk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Agent Development Kit for TypeScript with multi-provider LLM support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",