fmp-ai-tools 0.2.4-beta.0 → 0.2.4-beta.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/README.md +2 -0
- package/dist/providers/openai/index.js +139 -52
- package/dist/providers/openai/index.js.map +1 -1
- package/dist/providers/openai/index.mjs +139 -52
- package/dist/providers/openai/index.mjs.map +1 -1
- package/dist/providers/vercel-ai/index.js +139 -52
- package/dist/providers/vercel-ai/index.js.map +1 -1
- package/dist/providers/vercel-ai/index.mjs +139 -52
- package/dist/providers/vercel-ai/index.mjs.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -339,6 +339,8 @@ Each tool accepts specific parameters. Here are some common ones:
|
|
|
339
339
|
- `from` - Start date in YYYY-MM-DD format
|
|
340
340
|
- `to` - End date in YYYY-MM-DD format
|
|
341
341
|
- `name` - For economic indicators: specific indicator name
|
|
342
|
+
- `limit` - Max rows returned by tools that wrap large list endpoints (earnings/economic calendars, institutional and ETF holdings, market performance, executive compensation, congressional trades by name; defaults 20–50). When rows are cut, the tool returns `{ data, truncated: true, note }` saying how many rows exist. Institutional holders (latest filing per holder from the past year) and ETF holdings (latest filing date by default) are sorted largest-first.
|
|
343
|
+
- `symbols` - `getEarningsCalendar` only: return just these companies (a week can hold ~2,000 worldwide)
|
|
342
344
|
|
|
343
345
|
## Error Handling
|
|
344
346
|
|
|
@@ -192,6 +192,25 @@ function toToolResponse(res) {
|
|
|
192
192
|
}
|
|
193
193
|
return JSON.stringify(res.data, null, 2);
|
|
194
194
|
}
|
|
195
|
+
function limitRows(res, limit2, compare) {
|
|
196
|
+
if (res.success === false || !Array.isArray(res.data)) return res;
|
|
197
|
+
const rows = compare ? [...res.data].sort(compare) : res.data;
|
|
198
|
+
return { ...res, data: rows.slice(0, limit2) };
|
|
199
|
+
}
|
|
200
|
+
function toCappedToolResponse(res, limit2, options = {}) {
|
|
201
|
+
const total = res.success !== false && Array.isArray(res.data) ? res.data.length : 0;
|
|
202
|
+
const capped = limitRows(res, limit2, options.compare);
|
|
203
|
+
if (total <= limit2) return toToolResponse(capped);
|
|
204
|
+
return JSON.stringify(
|
|
205
|
+
{
|
|
206
|
+
data: capped.data,
|
|
207
|
+
truncated: true,
|
|
208
|
+
note: `Showing ${limit2} of ${total} rows. ${options.hint ?? "Increase `limit` to see more."}`
|
|
209
|
+
},
|
|
210
|
+
null,
|
|
211
|
+
2
|
|
212
|
+
);
|
|
213
|
+
}
|
|
195
214
|
function toToolError(error) {
|
|
196
215
|
const message = error instanceof Error ? error.message : String(error);
|
|
197
216
|
let type = "unknown";
|
|
@@ -273,7 +292,7 @@ var quoteDefinitions = [
|
|
|
273
292
|
to: zod.z.string().optional().nullable().describe("End date in YYYY-MM-DD format (optional)"),
|
|
274
293
|
limit: zod.z.number().int().positive().default(30).describe("Max number of most-recent days to return (default 30)")
|
|
275
294
|
}),
|
|
276
|
-
execute: async ({ symbol: symbol2, from, to, limit: limit2
|
|
295
|
+
execute: async ({ symbol: symbol2, from, to, limit: limit2 }) => {
|
|
277
296
|
const res = await getFMPClient().quote.getHistoricalPrice({
|
|
278
297
|
symbol: symbol2,
|
|
279
298
|
from: from ?? void 0,
|
|
@@ -283,7 +302,7 @@ var quoteDefinitions = [
|
|
|
283
302
|
if (res.success && data && Array.isArray(data.historical)) {
|
|
284
303
|
return toToolResponse({
|
|
285
304
|
...res,
|
|
286
|
-
data: { ...data, historical: data.historical.slice(0, limit2) }
|
|
305
|
+
data: { ...data, historical: data.historical.slice(0, limit2 ?? 30) }
|
|
287
306
|
});
|
|
288
307
|
}
|
|
289
308
|
return toToolResponse(res);
|
|
@@ -299,7 +318,7 @@ var quoteDefinitions = [
|
|
|
299
318
|
to: zod.z.string().optional().nullable().describe("End date in YYYY-MM-DD format (optional)"),
|
|
300
319
|
limit: zod.z.number().int().positive().default(50).describe("Max number of most-recent bars to return (default 50)")
|
|
301
320
|
}),
|
|
302
|
-
execute: async ({ symbol: symbol2, interval = "5min", from, to, limit: limit2
|
|
321
|
+
execute: async ({ symbol: symbol2, interval = "5min", from, to, limit: limit2 }) => {
|
|
303
322
|
const res = await getFMPClient().quote.getIntraday({
|
|
304
323
|
symbol: symbol2,
|
|
305
324
|
interval,
|
|
@@ -307,7 +326,7 @@ var quoteDefinitions = [
|
|
|
307
326
|
to: to ?? void 0
|
|
308
327
|
});
|
|
309
328
|
if (res.success && Array.isArray(res.data)) {
|
|
310
|
-
return toToolResponse({ ...res, data: res.data.slice(0, limit2) });
|
|
329
|
+
return toToolResponse({ ...res, data: res.data.slice(0, limit2 ?? 50) });
|
|
311
330
|
}
|
|
312
331
|
return toToolResponse(res);
|
|
313
332
|
}
|
|
@@ -331,9 +350,11 @@ var companyDefinitions = [
|
|
|
331
350
|
}),
|
|
332
351
|
defineTool({
|
|
333
352
|
name: "getCompanyExecutiveCompensation",
|
|
334
|
-
description: "Get the company executive compensation",
|
|
335
|
-
inputSchema: symbolSchema
|
|
336
|
-
|
|
353
|
+
description: "Get the company executive compensation (at most `limit` records)",
|
|
354
|
+
inputSchema: symbolSchema.extend({
|
|
355
|
+
limit: zod.z.number().int().positive().default(20).describe("Max number of compensation records to return (default 20)")
|
|
356
|
+
}),
|
|
357
|
+
execute: async ({ symbol: symbol2, limit: limit2 }) => toCappedToolResponse(await getFMPClient().company.getExecutiveCompensation(symbol2), limit2 ?? 20)
|
|
337
358
|
}),
|
|
338
359
|
defineTool({
|
|
339
360
|
name: "getStockPeers",
|
|
@@ -349,7 +370,7 @@ var statementTool = (name, description, what, call) => defineTool({
|
|
|
349
370
|
name,
|
|
350
371
|
description,
|
|
351
372
|
inputSchema: zod.z.object({ symbol: symbol(what), period, limit }),
|
|
352
|
-
execute: async ({ symbol: symbol2, period: period2, limit: limit2 }) => toToolResponse(await call({ symbol: symbol2, period: period2, limit: limit2 }))
|
|
373
|
+
execute: async ({ symbol: symbol2, period: period2, limit: limit2 }) => toToolResponse(await call({ symbol: symbol2, period: period2, limit: limit2 ?? void 0 }))
|
|
353
374
|
});
|
|
354
375
|
var financialDefinitions = [
|
|
355
376
|
statementTool(
|
|
@@ -378,7 +399,7 @@ var financialDefinitions = [
|
|
|
378
399
|
),
|
|
379
400
|
statementTool(
|
|
380
401
|
"getFinancialRatios",
|
|
381
|
-
"Get financial ratios for a company
|
|
402
|
+
"Get financial ratios for a company by period: valuation (P/E incl. diluted P/E, PEG, P/B, P/S, P/FCF, EV multiple), profitability margins, liquidity, leverage, efficiency, and per-share metrics",
|
|
382
403
|
"financial ratios",
|
|
383
404
|
(args) => getFMPClient().financial.getFinancialRatios(args)
|
|
384
405
|
),
|
|
@@ -419,7 +440,9 @@ var financialDefinitions = [
|
|
|
419
440
|
symbol: symbol("earnings historical"),
|
|
420
441
|
limit: zod.z.number().default(10).describe("The number of periods to retrieve")
|
|
421
442
|
}),
|
|
422
|
-
execute: async ({ symbol: symbol2, limit: limit2 }) => toToolResponse(
|
|
443
|
+
execute: async ({ symbol: symbol2, limit: limit2 }) => toToolResponse(
|
|
444
|
+
await getFMPClient().financial.getEarningsHistorical({ symbol: symbol2, limit: limit2 ?? 10 })
|
|
445
|
+
)
|
|
423
446
|
}),
|
|
424
447
|
defineTool({
|
|
425
448
|
name: "getFinancialScores",
|
|
@@ -435,7 +458,7 @@ var financialDefinitions = [
|
|
|
435
458
|
}),
|
|
436
459
|
defineTool({
|
|
437
460
|
name: "getFinancialRatiosTTM",
|
|
438
|
-
description: "Get current trailing-twelve-month (TTM) financial ratios for a company (margins,
|
|
461
|
+
description: "Get current trailing-twelve-month (TTM) financial ratios for a company (one snapshot row): valuation (P/E incl. diluted P/E, PEG, P/B, P/S, P/FCF, EV multiple), margins, liquidity, leverage, and per-share metrics",
|
|
439
462
|
inputSchema: zod.z.object({ symbol: symbol("TTM financial ratios") }),
|
|
440
463
|
execute: async ({ symbol: symbol2 }) => toToolResponse(await getFMPClient().financial.getFinancialRatiosTTM({ symbol: symbol2 }))
|
|
441
464
|
}),
|
|
@@ -458,29 +481,39 @@ var financialDefinitions = [
|
|
|
458
481
|
];
|
|
459
482
|
var dateRangeSchema = zod.z.object({
|
|
460
483
|
from: zod.z.string().optional().nullable().describe("Start date in YYYY-MM-DD format (optional)"),
|
|
461
|
-
to: zod.z.string().optional().nullable().describe("End date in YYYY-MM-DD format (optional)")
|
|
484
|
+
to: zod.z.string().optional().nullable().describe("End date in YYYY-MM-DD format (optional)"),
|
|
485
|
+
limit: zod.z.number().int().positive().default(50).describe("Max number of entries to return (default 50)")
|
|
462
486
|
});
|
|
463
487
|
var calendarDefinitions = [
|
|
464
488
|
defineTool({
|
|
465
489
|
name: "getEarningsCalendar",
|
|
466
|
-
description: "Get earnings calendar showing upcoming and recent earnings announcements",
|
|
467
|
-
inputSchema: dateRangeSchema
|
|
468
|
-
|
|
469
|
-
|
|
490
|
+
description: "Get earnings calendar showing upcoming and recent earnings announcements, in date order. A week can hold ~2,000 companies worldwide, so pass `symbols` to look up specific companies (e.g. mega-cap tech) instead of scanning the whole calendar.",
|
|
491
|
+
inputSchema: dateRangeSchema.extend({
|
|
492
|
+
symbols: zod.z.array(zod.z.string().min(1)).optional().nullable().describe('Only return these symbols (e.g., ["AAPL", "MSFT", "NVDA"])')
|
|
493
|
+
}),
|
|
494
|
+
execute: async ({ from, to, symbols, limit: limit2 }) => {
|
|
495
|
+
const res = await getFMPClient().calendar.getEarningsCalendar({
|
|
470
496
|
from: from ?? void 0,
|
|
471
497
|
to: to ?? void 0
|
|
472
|
-
})
|
|
473
|
-
|
|
498
|
+
});
|
|
499
|
+
const wanted = symbols?.length ? new Set(symbols.map((s) => s.toUpperCase())) : null;
|
|
500
|
+
const filtered = wanted && res.success !== false && Array.isArray(res.data) ? { ...res, data: res.data.filter((row) => wanted.has(row.symbol.toUpperCase())) } : res;
|
|
501
|
+
return toCappedToolResponse(filtered, limit2 ?? 50, {
|
|
502
|
+
hint: "Rows are in date order. Pass `symbols` to find specific companies, or narrow the date range."
|
|
503
|
+
});
|
|
504
|
+
}
|
|
474
505
|
}),
|
|
475
506
|
defineTool({
|
|
476
507
|
name: "getEconomicCalendar",
|
|
477
|
-
description: "Get economic calendar showing upcoming and recent economic events and indicators",
|
|
508
|
+
description: "Get economic calendar showing upcoming and recent economic events and indicators, in date order (at most `limit` entries; narrow the date range for full coverage)",
|
|
478
509
|
inputSchema: dateRangeSchema,
|
|
479
|
-
execute: async ({ from, to }) =>
|
|
510
|
+
execute: async ({ from, to, limit: limit2 }) => toCappedToolResponse(
|
|
480
511
|
await getFMPClient().calendar.getEconomicsCalendar({
|
|
481
512
|
from: from ?? void 0,
|
|
482
513
|
to: to ?? void 0
|
|
483
|
-
})
|
|
514
|
+
}),
|
|
515
|
+
limit2 ?? 50,
|
|
516
|
+
{ hint: "Rows are in date order; narrow the date range to see the rest." }
|
|
484
517
|
)
|
|
485
518
|
})
|
|
486
519
|
];
|
|
@@ -544,17 +577,32 @@ var economicDefinitions = [
|
|
|
544
577
|
var etfDefinitions = [
|
|
545
578
|
defineTool({
|
|
546
579
|
name: "getETFHoldings",
|
|
547
|
-
description: "Get
|
|
580
|
+
description: "Get the largest holdings of an ETF (by portfolio weight), showing the underlying assets and their weights",
|
|
548
581
|
inputSchema: zod.z.object({
|
|
549
582
|
symbol: zod.z.string().min(1, "ETF symbol is required").describe("ETF symbol (e.g., SPY, QQQ, VTI)"),
|
|
550
|
-
date: zod.z.string().optional().nullable().describe("
|
|
583
|
+
date: zod.z.string().optional().nullable().describe("Holdings date in YYYY-MM-DD format (optional; defaults to the latest filing)"),
|
|
584
|
+
limit: zod.z.number().int().positive().default(50).describe("Max number of holdings to return, largest weight first (default 50)")
|
|
551
585
|
}),
|
|
552
|
-
execute: async ({ symbol: symbol2, date }) => {
|
|
586
|
+
execute: async ({ symbol: symbol2, date, limit: limit2 }) => {
|
|
587
|
+
const client = getFMPClient();
|
|
588
|
+
let holdingsDate = date ?? void 0;
|
|
589
|
+
if (!holdingsDate) {
|
|
590
|
+
const dates = await client.etf.getHoldingDates(symbol2);
|
|
591
|
+
if (dates.success !== false && Array.isArray(dates.data)) {
|
|
592
|
+
holdingsDate = dates.data.reduce(
|
|
593
|
+
(latest, d) => !latest || d.date > latest ? d.date : latest,
|
|
594
|
+
void 0
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
553
598
|
const params = { symbol: symbol2 };
|
|
554
|
-
if (
|
|
555
|
-
params.date =
|
|
599
|
+
if (holdingsDate) {
|
|
600
|
+
params.date = holdingsDate;
|
|
556
601
|
}
|
|
557
|
-
return
|
|
602
|
+
return toCappedToolResponse(await client.etf.getHoldings(params), limit2 ?? 50, {
|
|
603
|
+
compare: (a, b) => b.pctVal - a.pctVal,
|
|
604
|
+
hint: `Largest positions first, as of ${holdingsDate ?? "the requested date"}.`
|
|
605
|
+
});
|
|
558
606
|
}
|
|
559
607
|
}),
|
|
560
608
|
defineTool({
|
|
@@ -577,14 +625,36 @@ var insiderDefinitions = [
|
|
|
577
625
|
execute: async ({ symbol: symbol2, page }) => toToolResponse(await getFMPClient().insider.getInsiderTradesBySymbol(symbol2, page))
|
|
578
626
|
})
|
|
579
627
|
];
|
|
628
|
+
var YEAR_MS = 365 * 24 * 60 * 60 * 1e3;
|
|
629
|
+
var holderKey = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, " ").replace(/\b(inc|corp|corporation|co|llc|ltd|lp|plc|the)\b/g, " ").replace(/\s+/g, " ").trim();
|
|
630
|
+
function currentHolders(rows) {
|
|
631
|
+
const newest = rows.reduce((max, r) => Math.max(max, Date.parse(r.dateReported) || 0), 0);
|
|
632
|
+
const latest = /* @__PURE__ */ new Map();
|
|
633
|
+
for (const row of rows) {
|
|
634
|
+
const reported = Date.parse(row.dateReported);
|
|
635
|
+
if (!(reported >= newest - YEAR_MS)) continue;
|
|
636
|
+
const key = holderKey(row.holder);
|
|
637
|
+
const prev = latest.get(key);
|
|
638
|
+
if (!prev || reported > Date.parse(prev.dateReported)) latest.set(key, row);
|
|
639
|
+
}
|
|
640
|
+
return [...latest.values()];
|
|
641
|
+
}
|
|
580
642
|
var institutionalDefinitions = [
|
|
581
643
|
defineTool({
|
|
582
644
|
name: "getInstitutionalHolders",
|
|
583
|
-
description: "Get institutional holders
|
|
645
|
+
description: "Get a stock's largest current institutional holders by shares held (each holder's latest 13F filing from the past year)",
|
|
584
646
|
inputSchema: zod.z.object({
|
|
585
|
-
symbol: zod.z.string().min(1, "Stock symbol is required").describe("Stock symbol (e.g., AAPL, MSFT, GOOGL)")
|
|
647
|
+
symbol: zod.z.string().min(1, "Stock symbol is required").describe("Stock symbol (e.g., AAPL, MSFT, GOOGL)"),
|
|
648
|
+
limit: zod.z.number().int().positive().default(20).describe("Max number of holders to return, largest first (default 20)")
|
|
586
649
|
}),
|
|
587
|
-
execute: async ({ symbol: symbol2 }) =>
|
|
650
|
+
execute: async ({ symbol: symbol2, limit: limit2 }) => {
|
|
651
|
+
const res = await getFMPClient().institutional.getInstitutionalHolders({ symbol: symbol2 });
|
|
652
|
+
const current = res.success !== false && Array.isArray(res.data) ? { ...res, data: currentHolders(res.data) } : res;
|
|
653
|
+
return toCappedToolResponse(current, limit2 ?? 20, {
|
|
654
|
+
compare: (a, b) => b.shares - a.shares,
|
|
655
|
+
hint: "Holders are ordered by shares held, largest first."
|
|
656
|
+
});
|
|
657
|
+
}
|
|
588
658
|
})
|
|
589
659
|
];
|
|
590
660
|
var empty = zod.z.object({});
|
|
@@ -595,9 +665,11 @@ var snapshotDateSchema = zod.z.object({
|
|
|
595
665
|
var marketDefinitions = [
|
|
596
666
|
defineTool({
|
|
597
667
|
name: "getMarketPerformance",
|
|
598
|
-
description: "Get overall market performance data including major indices performance",
|
|
599
|
-
inputSchema:
|
|
600
|
-
|
|
668
|
+
description: "Get overall market performance data including major indices performance (at most `limit` indices)",
|
|
669
|
+
inputSchema: zod.z.object({
|
|
670
|
+
limit: zod.z.number().int().positive().default(50).describe("Max number of indices to return (default 50)")
|
|
671
|
+
}),
|
|
672
|
+
execute: async ({ limit: limit2 }) => toCappedToolResponse(await getFMPClient().market.getMarketPerformance(), limit2 ?? 50)
|
|
601
673
|
}),
|
|
602
674
|
defineTool({
|
|
603
675
|
name: "getSectorPerformance",
|
|
@@ -649,11 +721,11 @@ var newsDefinitions = [
|
|
|
649
721
|
to: zod.z.string().optional().nullable().describe("End date in YYYY-MM-DD format (optional)"),
|
|
650
722
|
limit: zod.z.number().int().positive().default(20).describe("Max number of articles to return (default 20)")
|
|
651
723
|
}),
|
|
652
|
-
execute: async ({ from, to, limit: limit2
|
|
724
|
+
execute: async ({ from, to, limit: limit2 }) => toToolResponse(
|
|
653
725
|
await getFMPClient().news.getStockNews({
|
|
654
726
|
from: from ?? void 0,
|
|
655
727
|
to: to ?? void 0,
|
|
656
|
-
limit: limit2
|
|
728
|
+
limit: limit2 ?? 20
|
|
657
729
|
})
|
|
658
730
|
)
|
|
659
731
|
}),
|
|
@@ -666,12 +738,12 @@ var newsDefinitions = [
|
|
|
666
738
|
to: zod.z.string().optional().nullable().describe("End date in YYYY-MM-DD format (optional)"),
|
|
667
739
|
limit: zod.z.number().int().positive().default(20).describe("Max number of articles to return (default 20)")
|
|
668
740
|
}),
|
|
669
|
-
execute: async ({ symbols, from, to, limit: limit2
|
|
741
|
+
execute: async ({ symbols, from, to, limit: limit2 }) => toToolResponse(
|
|
670
742
|
await getFMPClient().news.getStockNewsBySymbol({
|
|
671
743
|
symbols,
|
|
672
744
|
from: from ?? void 0,
|
|
673
745
|
to: to ?? void 0,
|
|
674
|
-
limit: limit2
|
|
746
|
+
limit: limit2 ?? 20
|
|
675
747
|
})
|
|
676
748
|
)
|
|
677
749
|
})
|
|
@@ -693,8 +765,8 @@ var screenerDefinitions = [
|
|
|
693
765
|
isActivelyTrading: zod.z.boolean().optional().nullable().describe("Restrict to actively trading"),
|
|
694
766
|
limit: zod.z.number().int().positive().default(50).describe("Max number of results to return (default 50)")
|
|
695
767
|
}),
|
|
696
|
-
execute: async ({ limit: limit2
|
|
697
|
-
const params = { limit: limit2 };
|
|
768
|
+
execute: async ({ limit: limit2, ...filters }) => {
|
|
769
|
+
const params = { limit: limit2 ?? 50 };
|
|
698
770
|
for (const [key, value] of Object.entries(filters)) {
|
|
699
771
|
if (value !== null && value !== void 0) params[key] = value;
|
|
700
772
|
}
|
|
@@ -711,8 +783,12 @@ var searchDefinitions = [
|
|
|
711
783
|
limit: zod.z.number().int().positive().default(10).describe("Max number of results to return (default 10)"),
|
|
712
784
|
exchange: zod.z.string().optional().nullable().describe('Restrict to a specific exchange (optional, e.g., "NASDAQ")')
|
|
713
785
|
}),
|
|
714
|
-
execute: async ({ query, limit: limit2
|
|
715
|
-
await getFMPClient().search.search({
|
|
786
|
+
execute: async ({ query, limit: limit2, exchange }) => toToolResponse(
|
|
787
|
+
await getFMPClient().search.search({
|
|
788
|
+
query,
|
|
789
|
+
limit: limit2 ?? 10,
|
|
790
|
+
exchange: exchange ?? void 0
|
|
791
|
+
})
|
|
716
792
|
)
|
|
717
793
|
})
|
|
718
794
|
];
|
|
@@ -725,7 +801,9 @@ var analystDefinitions = [
|
|
|
725
801
|
period: zod.z.enum(["annual", "quarter"]).default("annual").describe("The period type (annual or quarter)"),
|
|
726
802
|
limit: zod.z.number().int().positive().default(10).describe("Max number of periods to return (default 10)")
|
|
727
803
|
}),
|
|
728
|
-
execute: async ({ symbol: symbol2, period: period2 = "annual", limit: limit2
|
|
804
|
+
execute: async ({ symbol: symbol2, period: period2 = "annual", limit: limit2 }) => toToolResponse(
|
|
805
|
+
await getFMPClient().analyst.getEstimates({ symbol: symbol2, period: period2, limit: limit2 ?? 10 })
|
|
806
|
+
)
|
|
729
807
|
}),
|
|
730
808
|
defineTool({
|
|
731
809
|
name: "getPriceTargetConsensus",
|
|
@@ -742,10 +820,10 @@ var analystDefinitions = [
|
|
|
742
820
|
symbol: zod.z.string().min(1).describe("The stock symbol (e.g., AAPL)"),
|
|
743
821
|
limit: zod.z.number().int().positive().default(20).describe("Max number of grade entries to return (default 20)")
|
|
744
822
|
}),
|
|
745
|
-
execute: async ({ symbol: symbol2, limit: limit2
|
|
823
|
+
execute: async ({ symbol: symbol2, limit: limit2 }) => {
|
|
746
824
|
const res = await getFMPClient().analyst.getGrades({ symbol: symbol2 });
|
|
747
825
|
if (res.success && Array.isArray(res.data)) {
|
|
748
|
-
return toToolResponse({ ...res, data: res.data.slice(0, limit2) });
|
|
826
|
+
return toToolResponse({ ...res, data: res.data.slice(0, limit2 ?? 20) });
|
|
749
827
|
}
|
|
750
828
|
return toToolResponse(res);
|
|
751
829
|
}
|
|
@@ -787,7 +865,7 @@ var technicalDefinitions = [
|
|
|
787
865
|
timeframe: zod.z.enum(["1min", "5min", "15min", "30min", "1hour", "4hour", "1day", "1week", "1month"]).default("1day").describe("Bar timeframe"),
|
|
788
866
|
limit: zod.z.number().int().positive().default(50).describe("Max number of most-recent bars to return (default 50)")
|
|
789
867
|
}),
|
|
790
|
-
execute: async ({ symbol: symbol2, type, periodLength = 10, timeframe = "1day", limit: limit2
|
|
868
|
+
execute: async ({ symbol: symbol2, type, periodLength = 10, timeframe = "1day", limit: limit2 }) => {
|
|
791
869
|
const res = await getFMPClient().technical.getTechnicalIndicator({
|
|
792
870
|
symbol: symbol2,
|
|
793
871
|
type,
|
|
@@ -795,12 +873,13 @@ var technicalDefinitions = [
|
|
|
795
873
|
timeframe
|
|
796
874
|
});
|
|
797
875
|
if (res.success && Array.isArray(res.data)) {
|
|
798
|
-
return toToolResponse({ ...res, data: res.data.slice(0, limit2) });
|
|
876
|
+
return toToolResponse({ ...res, data: res.data.slice(0, limit2 ?? 50) });
|
|
799
877
|
}
|
|
800
878
|
return toToolResponse(res);
|
|
801
879
|
}
|
|
802
880
|
})
|
|
803
881
|
];
|
|
882
|
+
var byNameLimit = zod.z.number().int().positive().default(50).describe("Max number of trades to return (default 50)");
|
|
804
883
|
var symbolSchema3 = zod.z.object({
|
|
805
884
|
symbol: zod.z.string().min(1, "Stock symbol is required").describe("Stock symbol (e.g., AAPL, MSFT, GOOGL)")
|
|
806
885
|
});
|
|
@@ -822,19 +901,27 @@ var senateHouseDefinitions = [
|
|
|
822
901
|
}),
|
|
823
902
|
defineTool({
|
|
824
903
|
name: "getSenateTradingByName",
|
|
825
|
-
description: "Get senate trading data for a specific senator by name showing their trading activity",
|
|
904
|
+
description: "Get senate trading data for a specific senator by name showing their trading activity (at most `limit` trades)",
|
|
826
905
|
inputSchema: zod.z.object({
|
|
827
|
-
name: zod.z.string().min(1, "Name is required").describe("The name of the senator to get trading data for")
|
|
906
|
+
name: zod.z.string().min(1, "Name is required").describe("The name of the senator to get trading data for"),
|
|
907
|
+
limit: byNameLimit
|
|
828
908
|
}),
|
|
829
|
-
execute: async ({ name }) =>
|
|
909
|
+
execute: async ({ name, limit: limit2 }) => toCappedToolResponse(
|
|
910
|
+
await getFMPClient().senateHouse.getSenateTradingByName({ name }),
|
|
911
|
+
limit2 ?? 50
|
|
912
|
+
)
|
|
830
913
|
}),
|
|
831
914
|
defineTool({
|
|
832
915
|
name: "getHouseTradingByName",
|
|
833
|
-
description: "Get house trading data for a specific representative by name showing their trading activity",
|
|
916
|
+
description: "Get house trading data for a specific representative by name showing their trading activity (at most `limit` trades)",
|
|
834
917
|
inputSchema: zod.z.object({
|
|
835
|
-
name: zod.z.string().min(1, "Name is required").describe("The name of the representative to get trading data for")
|
|
918
|
+
name: zod.z.string().min(1, "Name is required").describe("The name of the representative to get trading data for"),
|
|
919
|
+
limit: byNameLimit
|
|
836
920
|
}),
|
|
837
|
-
execute: async ({ name }) =>
|
|
921
|
+
execute: async ({ name, limit: limit2 }) => toCappedToolResponse(
|
|
922
|
+
await getFMPClient().senateHouse.getHouseTradingByName({ name }),
|
|
923
|
+
limit2 ?? 50
|
|
924
|
+
)
|
|
838
925
|
}),
|
|
839
926
|
defineTool({
|
|
840
927
|
name: "getSenateTradingRSSFeed",
|