@t2000/engine 0.6.1 → 0.6.2

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.d.ts CHANGED
@@ -1063,6 +1063,7 @@ declare const protocolDeepDiveTool: Tool<{
1063
1063
  declare const defillamaYieldPoolsTool: Tool<{
1064
1064
  limit?: number | undefined;
1065
1065
  chain?: string | undefined;
1066
+ minTvl?: number | undefined;
1066
1067
  }, {
1067
1068
  pool: string;
1068
1069
  protocol: string;
package/dist/index.js CHANGED
@@ -1889,18 +1889,26 @@ async function cachedFetch(url) {
1889
1889
  apiCache.set(url, { data, ts: Date.now() });
1890
1890
  return data;
1891
1891
  }
1892
+ function fmtToolTvl(tvl) {
1893
+ if (tvl >= 1e9) return `$${(tvl / 1e9).toFixed(1)}B`;
1894
+ if (tvl >= 1e6) return `$${(tvl / 1e6).toFixed(1)}M`;
1895
+ if (tvl >= 1e3) return `$${(tvl / 1e3).toFixed(0)}K`;
1896
+ return `$${tvl}`;
1897
+ }
1892
1898
  var defillamaYieldPoolsTool = buildTool({
1893
1899
  name: "defillama_yield_pools",
1894
- description: 'Get top DeFi yield pools across all protocols. Filter by chain (e.g. "Sui") and sort by APY. Shows pool name, protocol, TVL, and APY breakdown.',
1900
+ description: 'Get top DeFi yield pools across all protocols. Filter by chain (e.g. "Sui") and sort by APY. Shows pool name, protocol, TVL, and APY breakdown. Use minTvl to filter out low-liquidity pools.',
1895
1901
  inputSchema: z.object({
1896
1902
  chain: z.string().optional().describe('Filter by chain name (e.g. "Sui", "Ethereum")'),
1897
- limit: z.number().min(1).max(20).optional().describe("Max results (default 5)")
1903
+ limit: z.number().min(1).max(20).optional().describe("Max results (default 5)"),
1904
+ minTvl: z.number().optional().describe("Minimum TVL in USD to filter out small/risky pools (default 100000)")
1898
1905
  }),
1899
1906
  jsonSchema: {
1900
1907
  type: "object",
1901
1908
  properties: {
1902
1909
  chain: { type: "string", description: "Filter by chain name" },
1903
- limit: { type: "number", description: "Max results (default 5)" }
1910
+ limit: { type: "number", description: "Max results (default 5)" },
1911
+ minTvl: { type: "number", description: "Minimum TVL in USD (default 100000)" }
1904
1912
  },
1905
1913
  required: []
1906
1914
  },
@@ -1912,6 +1920,8 @@ var defillamaYieldPoolsTool = buildTool({
1912
1920
  const chain = input.chain.toLowerCase();
1913
1921
  pools = pools.filter((p) => p.chain.toLowerCase() === chain);
1914
1922
  }
1923
+ const minTvl = input.minTvl ?? 1e5;
1924
+ pools = pools.filter((p) => p.tvlUsd >= minTvl);
1915
1925
  pools.sort((a, b) => b.apy - a.apy);
1916
1926
  const limit = input.limit ?? 5;
1917
1927
  const top = pools.slice(0, limit);
@@ -1926,7 +1936,7 @@ var defillamaYieldPoolsTool = buildTool({
1926
1936
  }));
1927
1937
  return {
1928
1938
  data: results,
1929
- displayText: results.map((r) => `${r.pool} (${r.protocol}): ${r.apy}% APY, $${(r.tvl / 1e6).toFixed(1)}M TVL`).join("\n")
1939
+ displayText: results.map((r) => `${r.pool} (${r.protocol}): ${r.apy}% APY, ${fmtToolTvl(r.tvl)} TVL`).join("\n")
1930
1940
  };
1931
1941
  }
1932
1942
  });
@@ -1958,7 +1968,7 @@ var defillamaProtocolInfoTool = buildTool({
1958
1968
  };
1959
1969
  return {
1960
1970
  data: result,
1961
- displayText: `${result.name}: $${(result.tvl / 1e6).toFixed(1)}M TVL (${result.category}) on ${result.chains.join(", ")}`
1971
+ displayText: `${result.name}: ${fmtToolTvl(result.tvl)} TVL (${result.category}) on ${result.chains.join(", ")}`
1962
1972
  };
1963
1973
  }
1964
1974
  });
@@ -2136,7 +2146,7 @@ var defillamaSuiProtocolsTool = buildTool({
2136
2146
  }));
2137
2147
  return {
2138
2148
  data: results,
2139
- displayText: results.map((r, i) => `${i + 1}. ${r.name} ($${(r.tvl / 1e6).toFixed(1)}M TVL, ${r.category})`).join("\n")
2149
+ displayText: results.map((r, i) => `${i + 1}. ${r.name} (${fmtToolTvl(r.tvl)} TVL, ${r.category})`).join("\n")
2140
2150
  };
2141
2151
  }
2142
2152
  });