This is page 2 of 2. Use http://codebase.md/donmorr/alphavantagemcpserver?lines=true&page={x} to view the full context. # Directory Structure ``` ├── .gitignore ├── LICENSE ├── pyproject.toml ├── README.md └── src └── mcp_server_alphavantage ├── __init__.py ├── api.py └── server.py ``` # Files -------------------------------------------------------------------------------- /src/mcp_server_alphavantage/server.py: -------------------------------------------------------------------------------- ```python 1 | import json 2 | from enum import Enum 3 | 4 | import mcp.server.stdio 5 | import mcp.types as types 6 | from mcp.server import NotificationOptions, Server 7 | from mcp.server.models import InitializationOptions 8 | 9 | from .api import ( 10 | fetch_quote, 11 | fetch_intraday, 12 | fetch_time_series_daily, 13 | fetch_time_series_daily_adjusted, 14 | fetch_time_series_weekly, 15 | fetch_time_series_weekly_adjusted, 16 | fetch_time_series_monthly, 17 | fetch_time_series_monthly_adjusted, 18 | fetch_realtime_bulk_quotes, 19 | search_endpoint, 20 | fetch_market_status, 21 | fetch_realtime_options, 22 | fetch_historical_options, 23 | fetch_news_sentiment, 24 | fetch_top_gainer_losers, 25 | fetch_insider_transactions, 26 | fetch_analytics_fixed_window, 27 | fetch_analytics_sliding_window, 28 | fetch_company_overview, 29 | company_dividends, 30 | fetch_etf_profile, 31 | fetch_company_splits, 32 | fetch_income_statement, 33 | fetch_balance_sheet, 34 | fetch_cash_flow, 35 | fetch_listing_status, 36 | fetch_earnings_calendar, 37 | fetch_ipo_calendar, 38 | fetch_exchange_rate, 39 | fetch_fx_intraday, 40 | fetch_fx_daily, 41 | fetch_fx_weekly, 42 | fetch_fx_monthly, 43 | fetch_digital_currency_intraday, 44 | fetch_digital_currency_daily, 45 | fetch_digital_currency_monthly, 46 | fetch_wti_crude, 47 | fetch_brent_crude, 48 | fetch_natural_gas, 49 | fetch_copper, 50 | fetch_aluminum, 51 | fetch_wheat, 52 | fetch_corn, 53 | fetch_cotton, 54 | fetch_sugar, 55 | fetch_coffee, 56 | fetch_all_commodities, 57 | fetch_real_gdp, 58 | fetch_real_gdp_per_capita, 59 | fetch_treasury_yield, 60 | fetch_federal_funds_rate, 61 | fetch_cpi, 62 | fetch_inflation, 63 | fetch_retail_sales, 64 | fetch_durables, 65 | fetch_unemployment, 66 | fetch_nonfarm_payrolls, 67 | fetch_sma, 68 | fetch_ema, 69 | fetch_wma, 70 | fetch_dema, 71 | fetch_tema, 72 | fetch_trima, 73 | fetch_kama, 74 | fetch_mama, 75 | fetch_t3, 76 | fetch_macd, 77 | fetch_macdext, 78 | fetch_stoch, 79 | fetch_stochf, 80 | fetch_rsi, 81 | fetch_stochrsi, 82 | fetch_willr, 83 | fetch_adx, 84 | fetch_adxr, 85 | fetch_apo, 86 | fetch_ppo, 87 | fetch_mom, 88 | fetch_bop, 89 | fetch_cci, 90 | fetch_cmo, 91 | fetch_roc, 92 | fetch_rocr, 93 | fetch_aroon, 94 | fetch_aroonosc, 95 | fetch_mfi, 96 | fetch_trix, 97 | fetch_ultosc, 98 | fetch_dx, 99 | fetch_minus_di, 100 | fetch_plus_di, 101 | fetch_minus_dm, 102 | fetch_plus_dm, 103 | fetch_bbands, 104 | fetch_midpoint, 105 | fetch_midprice, 106 | fetch_sar, 107 | fetch_trange, 108 | fetch_atr, 109 | fetch_natr, 110 | fetch_ad, 111 | fetch_adosc, 112 | fetch_obv, 113 | fetch_ht_trendline, 114 | fetch_ht_sine, 115 | fetch_ht_trendmode, 116 | fetch_ht_dcperiod, 117 | fetch_ht_dcphase, 118 | fetch_ht_phasor, 119 | ) 120 | 121 | 122 | class AlphavantageTools(str, Enum): 123 | TIME_SERIES_INTRADAY = "time_series_intraday" 124 | TIME_SERIES_DAILY = "time_series_daily" 125 | TIME_SERIES_DAILY_ADJUSTED = "time_series_daily_adjusted" 126 | TIME_SERIES_WEEKLY = "time_series_weekly" 127 | TIME_SERIES_WEEKLY_ADJUSTED = "time_series_weekly_adjusted" 128 | TIME_SERIES_MONTHLY = "time_series_monthly" 129 | TIME_SERIES_MONTHLY_ADJUSTED = "time_series_monthly_adjusted" 130 | STOCK_QUOTE = "stock_quote" 131 | REALTIME_BULK_QUOTES = "realtime_bulk_quotes" 132 | SYMBOL_SEARCH = "symbol_search" 133 | MARKET_STATUS = "market_status" 134 | REALTIME_OPTIONS = "realtime_options" 135 | HISTORICAL_OPTIONS = "historical_options" 136 | NEWS_SENTIMENT = "news_sentiment" 137 | TOP_GAINERS_LOSERS = "top_gainers_losers" 138 | INSIDER_TRANSACTIONS = "insider_transactions" 139 | ANALYTICS_FIXED_WINDOW = "analytics_fixed_window" 140 | ANALYTICS_SLIDING_WINDOW = "analytics_sliding_window" 141 | COMPANY_OVERVIEW = "company_overview" 142 | ETF_PROFILE = "etf_profile" 143 | COMPANY_DIVIDENDS = "company_dividends" 144 | COMPANY_SPLITS = "company_splits" 145 | INCOME_STATEMENT = "income_statement" 146 | BALANCE_SHEET = "balance_sheet" 147 | CASH_FLOW = "cash_flow" 148 | COMPANY_EARNINGS = "company_earnings" 149 | LISTING_STATUS = "listing_status" 150 | EARNINGS_CALENDAR = "earnings_calendar" 151 | IPO_CALENDAR = "ipo_calendar" 152 | EXCHANGE_RATE = "exchange_rate" 153 | FX_INTRADAY = "fx_intraday" 154 | FX_DAILY = "fx_daily" 155 | FX_WEEKLY = "fx_weekly" 156 | FX_MONTHLY = "fx_monthly" 157 | CRYPTO_INTRADAY = "crypto_intraday" 158 | DIGITAL_CURRENCY_DAILY = "digital_currency_daily" 159 | DIGITAL_CURRENCY_WEEKLY = "digital_currency_weekly" 160 | DIGITAL_CURRENCY_MONTHLY = "digital_currency_monthly" 161 | WTI_CRUDE_OIL = "wti_crude_oil" 162 | BRENT_CRUDE_OIL = "brent_crude_oil" 163 | NATURAL_GAS = "natural_gas" 164 | COPPER = "copper" 165 | ALUMINUM = "aluminum" 166 | WHEAT = "wheat" 167 | CORN = "corn" 168 | COTTON = "cotton" 169 | SUGAR = "sugar" 170 | COFFEE = "coffee" 171 | ALL_COMMODITIES = "all_commodities" 172 | REAL_GDP = "real_gdp" 173 | REAL_GDP_PER_CAPITA = "real_gdp_per_capita" 174 | TREASURY_YIELD = "treasury_yield" 175 | FEDERAL_FUNDS_RATE = "federal_funds_rate" 176 | CPI = "cpi" 177 | INFLATION = "inflation" 178 | RETAIL_SALES = "retail_sales" 179 | DURABLES = "durables" 180 | UNEMPLOYMENT = "unemployment" 181 | NONFARM_PAYROLL = "nonfarm_payroll" 182 | SMA = "sma" 183 | EMA = "ema" 184 | WMA = "wma" 185 | DEMA = "dema" 186 | TEMA = "tema" 187 | TRIMA = "trima" 188 | KAMA = "kama" 189 | MAMA = "mama" 190 | VWAP = "vwap" 191 | T3 = "t3" 192 | MACD = "macd" 193 | MACDEXT = "macdext" 194 | STOCH = "stoch" 195 | STOCHF = "stochf" 196 | RSI = "rsi" 197 | STOCHRSI = "stochrsi" 198 | WILLR = "willr" 199 | ADX = "adx" 200 | ADXR = "adxr" 201 | APO = "apo" 202 | PPO = "ppo" 203 | MOM = "mom" 204 | BOP = "bop" 205 | CCI = "cci" 206 | CMO = "cmo" 207 | ROC = "roc" 208 | ROCR = "rocr" 209 | AROON = "aroon" 210 | AROONOSC = "aroonosc" 211 | MFI = "mfi" 212 | TRIX = "trix" 213 | ULTOSC = "ultosc" 214 | DX = "dx" 215 | MINUS_DI = "minus_di" 216 | PLUS_DI = "plus_di" 217 | MINUS_DM = "minus_dm" 218 | PLUS_DM = "plus_dm" 219 | BBANDS = "bbands" 220 | MIDPOINT = "midpoint" 221 | MIDPRICE = "midprice" 222 | SAR = "sar" 223 | TRANGE = "trange" 224 | ATR = "atr" 225 | NATR = "natr" 226 | AD = "ad" 227 | ADOSC = "adosc" 228 | OBV = "obv" 229 | HT_TRENDLINE = "ht_trendline" 230 | HT_SINE = "ht_sine" 231 | HT_TRENDMODE = "ht_trendmode" 232 | HT_DCPERIOD = "ht_dcperiod" 233 | HT_DCPHASE = "ht_dcphase" 234 | HT_PHASOR = "ht_phasor" 235 | 236 | 237 | server = Server("alphavantage") 238 | 239 | 240 | @server.list_tools() 241 | async def handle_list_tools() -> list[types.Tool]: 242 | """ 243 | List available tools. 244 | Each tool specifies its arguments using JSON Schema validation. 245 | """ 246 | return [ 247 | types.Tool( 248 | name=AlphavantageTools.STOCK_QUOTE.value, 249 | description="Fetch a stock quote", 250 | inputSchema={ 251 | "type": "object", 252 | "properties": { 253 | "symbol": {"type": "string"}, 254 | "datatype": {"type": "string"}, 255 | }, 256 | "required": ["symbol"], 257 | }, 258 | ), 259 | types.Tool( 260 | name=AlphavantageTools.TIME_SERIES_INTRADAY.value, 261 | description="Fetch a time series intraday", 262 | inputSchema={ 263 | "type": "object", 264 | "properties": { 265 | "symbol": {"type": "string"}, 266 | "interval": {"type": "string"}, 267 | "adjusted": {"type": "boolean"}, 268 | "outputsize": {"type": "string"}, 269 | "datatype": {"type": "string"}, 270 | "monthly": {"type": "string"}, 271 | }, 272 | "required": ["symbol", "interval"], 273 | }, 274 | ), 275 | types.Tool( 276 | name=AlphavantageTools.TIME_SERIES_DAILY.value, 277 | description="Fetch a time series daily", 278 | inputSchema={ 279 | "type": "object", 280 | "properties": { 281 | "symbol": {"type": "string"}, 282 | "outputsize": {"type": "string"}, 283 | "datatype": {"type": "string"}, 284 | }, 285 | "required": ["symbol"], 286 | }, 287 | ), 288 | types.Tool( 289 | name=AlphavantageTools.TIME_SERIES_DAILY_ADJUSTED.value, 290 | description="Fetch a time series daily adjusted", 291 | inputSchema={ 292 | "type": "object", 293 | "properties": { 294 | "symbol": {"type": "string"}, 295 | "outputsize": {"type": "string"}, 296 | "datatype": {"type": "string"}, 297 | }, 298 | "required": ["symbol"], 299 | }, 300 | ), 301 | types.Tool( 302 | name=AlphavantageTools.TIME_SERIES_WEEKLY.value, 303 | description="Fetch a time series weekly", 304 | inputSchema={ 305 | "type": "object", 306 | "properties": { 307 | "symbol": {"type": "string"}, 308 | "datatype": {"type": "string"}, 309 | }, 310 | "required": ["symbol"], 311 | }, 312 | ), 313 | types.Tool( 314 | name=AlphavantageTools.TIME_SERIES_WEEKLY_ADJUSTED.value, 315 | description="Fetch a time series weekly adjusted", 316 | inputSchema={ 317 | "type": "object", 318 | "properties": { 319 | "symbol": {"type": "string"}, 320 | "datatype": {"type": "string"}, 321 | }, 322 | "required": ["symbol"], 323 | }, 324 | ), 325 | types.Tool( 326 | name=AlphavantageTools.TIME_SERIES_MONTHLY.value, 327 | description="Fetch a time series monthly", 328 | inputSchema={ 329 | "type": "object", 330 | "properties": { 331 | "symbol": {"type": "string"}, 332 | "datatype": {"type": "string"}, 333 | }, 334 | "required": ["symbol"], 335 | }, 336 | ), 337 | types.Tool( 338 | name=AlphavantageTools.TIME_SERIES_MONTHLY_ADJUSTED.value, 339 | description="Fetch a time series monthly adjusted", 340 | inputSchema={ 341 | "type": "object", 342 | "properties": { 343 | "symbol": {"type": "string"}, 344 | "datatype": {"type": "string"}, 345 | }, 346 | "required": ["symbol"], 347 | }, 348 | ), 349 | types.Tool( 350 | name=AlphavantageTools.REALTIME_BULK_QUOTES.value, 351 | description="Fetch real time bulk quotes", 352 | inputSchema={ 353 | "type": "object", 354 | "properties": { 355 | "symbols": {"type": "array"}, 356 | }, 357 | "required": ["symbols"], 358 | }, 359 | ), 360 | types.Tool( 361 | name=AlphavantageTools.SYMBOL_SEARCH.value, 362 | description="Search endpoint", 363 | inputSchema={ 364 | "type": "object", 365 | "properties": { 366 | "keywords": {"type": "string"}, 367 | "datatype": {"type": "string"}, 368 | }, 369 | "required": ["keywords"], 370 | }, 371 | ), 372 | types.Tool( 373 | name=AlphavantageTools.MARKET_STATUS.value, 374 | description="Fetch market status", 375 | inputSchema={"type": "object", "properties": {}, "required": []}, 376 | ), 377 | types.Tool( 378 | name=AlphavantageTools.REALTIME_OPTIONS.value, 379 | description="Fetch realtime options", 380 | inputSchema={ 381 | "type": "object", 382 | "properties": { 383 | "symbol": {"type": "string"}, 384 | "datatype": {"type": "string"}, 385 | "contract": {"type": "string"}, 386 | }, 387 | "required": ["symbol"], 388 | }, 389 | ), 390 | types.Tool( 391 | name=AlphavantageTools.HISTORICAL_OPTIONS.value, 392 | description="Fetch historical options", 393 | inputSchema={ 394 | "type": "object", 395 | "properties": { 396 | "symbol": {"type": "string"}, 397 | "datatype": {"type": "string"}, 398 | "contract": {"type": "string"}, 399 | }, 400 | "required": ["symbol"], 401 | }, 402 | ), 403 | types.Tool( 404 | name=AlphavantageTools.NEWS_SENTIMENT.value, 405 | description="Fetch news sentiment", 406 | inputSchema={ 407 | "type": "object", 408 | "properties": { 409 | "tickers": {"type": "array"}, 410 | "topics": {"type": "string"}, 411 | "time_from": {"type": "string"}, 412 | "time_to": {"type": "string"}, 413 | "sort": {"type": "string"}, 414 | "limit": {"type": "number"}, 415 | "datatype": {"type": "string"}, 416 | }, 417 | "required": ["tickers"], 418 | }, 419 | ), 420 | types.Tool( 421 | name=AlphavantageTools.TOP_GAINERS_LOSERS.value, 422 | description="Fetch top gainers and losers", 423 | inputSchema={"type": "object", "properties": {}, "required": []}, 424 | ), 425 | types.Tool( 426 | name=AlphavantageTools.INSIDER_TRANSACTIONS.value, 427 | description="Fetch insider transactions", 428 | inputSchema={ 429 | "type": "object", 430 | "properties": { 431 | "symbol": {"type": "string"}, 432 | }, 433 | "required": ["symbol"], 434 | }, 435 | ), 436 | types.Tool( 437 | name=AlphavantageTools.ANALYTICS_FIXED_WINDOW.value, 438 | description="Fetch analytics fixed window", 439 | inputSchema={ 440 | "type": "object", 441 | "properties": { 442 | "symbols": {"type": "array"}, 443 | "interval": {"type": "string"}, 444 | "series_range": {"type": "string"}, 445 | "ohlc": {"type": "string"}, 446 | "calculations": {"type": "array"}, 447 | }, 448 | "required": ["symbols", "series_range", "interval", "calculations"], 449 | }, 450 | ), 451 | types.Tool( 452 | name=AlphavantageTools.ANALYTICS_SLIDING_WINDOW.value, 453 | description="Fetch analytics sliding window", 454 | inputSchema={ 455 | "type": "object", 456 | "properties": { 457 | "symbols": {"type": "array"}, 458 | "interval": {"type": "string"}, 459 | "series_range": {"type": "string"}, 460 | "ohlc": {"type": "string"}, 461 | "window_size": {"type": "number"}, 462 | "calculations": {"type": "array"}, 463 | }, 464 | "required": [ 465 | "symbols", 466 | "series_range", 467 | "interval", 468 | "calculations", 469 | "window_size", 470 | ], 471 | }, 472 | ), 473 | types.Tool( 474 | name=AlphavantageTools.COMPANY_OVERVIEW.value, 475 | description="Fetch company overview", 476 | inputSchema={ 477 | "type": "object", 478 | "properties": { 479 | "symbol": {"type": "string"}, 480 | }, 481 | "required": ["symbol"], 482 | }, 483 | ), 484 | types.Tool( 485 | name=AlphavantageTools.ETF_PROFILE.value, 486 | description="Fetch ETF profile", 487 | inputSchema={ 488 | "type": "object", 489 | "properties": { 490 | "symbol": {"type": "string"}, 491 | }, 492 | "required": ["symbol"], 493 | }, 494 | ), 495 | types.Tool( 496 | name=AlphavantageTools.COMPANY_DIVIDENDS.value, 497 | description="Fetch company dividends", 498 | inputSchema={ 499 | "type": "object", 500 | "properties": { 501 | "symbol": {"type": "string"}, 502 | }, 503 | "required": ["symbol"], 504 | }, 505 | ), 506 | types.Tool( 507 | name=AlphavantageTools.COMPANY_SPLITS.value, 508 | description="Fetch company splits", 509 | inputSchema={ 510 | "type": "object", 511 | "properties": { 512 | "symbol": {"type": "string"}, 513 | }, 514 | "required": ["symbol"], 515 | }, 516 | ), 517 | types.Tool( 518 | name=AlphavantageTools.INCOME_STATEMENT.value, 519 | description="Fetch company income statement", 520 | inputSchema={ 521 | "type": "object", 522 | "properties": { 523 | "symbol": {"type": "string"}, 524 | }, 525 | "required": ["symbol"], 526 | }, 527 | ), 528 | types.Tool( 529 | name=AlphavantageTools.BALANCE_SHEET.value, 530 | description="Fetch company balance sheet", 531 | inputSchema={ 532 | "type": "object", 533 | "properties": { 534 | "symbol": {"type": "string"}, 535 | }, 536 | "required": ["symbol"], 537 | }, 538 | ), 539 | types.Tool( 540 | name=AlphavantageTools.CASH_FLOW.value, 541 | description="Fetch company cash flow", 542 | inputSchema={ 543 | "type": "object", 544 | "properties": { 545 | "symbol": {"type": "string"}, 546 | }, 547 | "required": ["symbol"], 548 | }, 549 | ), 550 | types.Tool( 551 | name=AlphavantageTools.LISTING_STATUS.value, 552 | description="Fetch listing status", 553 | inputSchema={ 554 | "type": "object", 555 | "properties": { 556 | "symbol": {"type": "string"}, 557 | "date": {"type": "string"}, 558 | "state": {"type": "string"}, 559 | }, 560 | "required": [], 561 | }, 562 | ), 563 | types.Tool( 564 | name=AlphavantageTools.EARNINGS_CALENDAR.value, 565 | description="Fetch company earnings calendar", 566 | inputSchema={ 567 | "type": "object", 568 | "properties": { 569 | "symbol": {"type": "string"}, 570 | "horizon": {"type": "string"}, 571 | }, 572 | "required": [], 573 | }, 574 | ), 575 | types.Tool( 576 | name=AlphavantageTools.IPO_CALENDAR.value, 577 | description="Fetch IPO calendar", 578 | inputSchema={"type": "object", "properties": {}, "required": []}, 579 | ), 580 | types.Tool( 581 | name=AlphavantageTools.EXCHANGE_RATE.value, 582 | description="Fetch exchange rate", 583 | inputSchema={ 584 | "type": "object", 585 | "properties": { 586 | "from_currency": {"type": "string"}, 587 | "to_currency": {"type": "string"}, 588 | }, 589 | "required": ["from_currency", "to_currency"], 590 | }, 591 | ), 592 | types.Tool( 593 | name=AlphavantageTools.FX_INTRADAY.value, 594 | description="Fetch FX intraday", 595 | inputSchema={ 596 | "type": "object", 597 | "properties": { 598 | "from_symbol": {"type": "string"}, 599 | "to_symbol": {"type": "string"}, 600 | "interval": {"type": "string"}, 601 | "outputsize": {"type": "string"}, 602 | "datatype": {"type": "string"}, 603 | }, 604 | "required": ["from_symbol", "to_symbol", "interval"], 605 | }, 606 | ), 607 | types.Tool( 608 | name=AlphavantageTools.FX_DAILY.value, 609 | description="Fetch FX daily", 610 | inputSchema={ 611 | "type": "object", 612 | "properties": { 613 | "from_symbol": {"type": "string"}, 614 | "to_symbol": {"type": "string"}, 615 | "datatype": {"type": "string"}, 616 | "outputsize": {"type": "string"}, 617 | }, 618 | "required": ["from_symbol", "to_symbol"], 619 | }, 620 | ), 621 | types.Tool( 622 | name=AlphavantageTools.FX_WEEKLY.value, 623 | description="Fetch FX weekly", 624 | inputSchema={ 625 | "type": "object", 626 | "properties": { 627 | "from_symbol": {"type": "string"}, 628 | "to_symbol": {"type": "string"}, 629 | "datatype": {"type": "string"}, 630 | }, 631 | "required": ["from_symbol", "to_symbol"], 632 | }, 633 | ), 634 | types.Tool( 635 | name=AlphavantageTools.FX_MONTHLY.value, 636 | description="Fetch FX monthly", 637 | inputSchema={ 638 | "type": "object", 639 | "properties": { 640 | "from_symbol": {"type": "string"}, 641 | "to_symbol": {"type": "string"}, 642 | "datatype": {"type": "string"}, 643 | }, 644 | "required": ["from_symbol", "to_symbol"], 645 | }, 646 | ), 647 | types.Tool( 648 | name=AlphavantageTools.CRYPTO_INTRADAY.value, 649 | description="Fetch crypto intraday", 650 | inputSchema={ 651 | "type": "object", 652 | "properties": { 653 | "symbol": {"type": "string"}, 654 | "market": {"type": "string"}, 655 | "interval": {"type": "string"}, 656 | "outputsize": {"type": "string"}, 657 | "datatype": {"type": "string"}, 658 | }, 659 | "required": ["symbol", "market", "interval"], 660 | }, 661 | ), 662 | types.Tool( 663 | name=AlphavantageTools.DIGITAL_CURRENCY_DAILY.value, 664 | description="Fetch digital currency daily", 665 | inputSchema={ 666 | "type": "object", 667 | "properties": { 668 | "symbol": {"type": "string"}, 669 | "market": {"type": "string"}, 670 | }, 671 | "required": ["symbol", "market"], 672 | }, 673 | ), 674 | types.Tool( 675 | name=AlphavantageTools.DIGITAL_CURRENCY_WEEKLY.value, 676 | description="Fetch digital currency weekly", 677 | inputSchema={ 678 | "type": "object", 679 | "properties": { 680 | "symbol": {"type": "string"}, 681 | "market": {"type": "string"}, 682 | }, 683 | "required": ["symbol", "market"], 684 | }, 685 | ), 686 | types.Tool( 687 | name=AlphavantageTools.DIGITAL_CURRENCY_MONTHLY.value, 688 | description="Fetch digital currency monthly", 689 | inputSchema={ 690 | "type": "object", 691 | "properties": { 692 | "symbol": {"type": "string"}, 693 | "market": {"type": "string"}, 694 | }, 695 | "required": ["symbol", "market"], 696 | }, 697 | ), 698 | types.Tool( 699 | name=AlphavantageTools.WTI_CRUDE_OIL.value, 700 | description="Fetch WTI crude oil", 701 | inputSchema={ 702 | "type": "object", 703 | "properties": { 704 | "interval": {"type": "string"}, 705 | "datatype": {"type": "string"}, 706 | }, 707 | "required": [], 708 | }, 709 | ), 710 | types.Tool( 711 | name=AlphavantageTools.BRENT_CRUDE_OIL.value, 712 | description="Fetch Brent crude oil", 713 | inputSchema={ 714 | "type": "object", 715 | "properties": { 716 | "interval": {"type": "string"}, 717 | "datatype": {"type": "string"}, 718 | }, 719 | "required": [], 720 | }, 721 | ), 722 | types.Tool( 723 | name=AlphavantageTools.NATURAL_GAS.value, 724 | description="Fetch natural gas", 725 | inputSchema={ 726 | "type": "object", 727 | "properties": { 728 | "interval": {"type": "string"}, 729 | "datatype": {"type": "string"}, 730 | }, 731 | "required": [], 732 | }, 733 | ), 734 | types.Tool( 735 | name=AlphavantageTools.COPPER.value, 736 | description="Fetch copper", 737 | inputSchema={ 738 | "type": "object", 739 | "properties": { 740 | "interval": {"type": "string"}, 741 | "datatype": {"type": "string"}, 742 | }, 743 | "required": [], 744 | }, 745 | ), 746 | types.Tool( 747 | name=AlphavantageTools.ALUMINUM.value, 748 | description="Fetch aluminum", 749 | inputSchema={ 750 | "type": "object", 751 | "properties": { 752 | "interval": {"type": "string"}, 753 | "datatype": {"type": "string"}, 754 | }, 755 | "required": [], 756 | }, 757 | ), 758 | types.Tool( 759 | name=AlphavantageTools.WHEAT.value, 760 | description="Fetch wheat", 761 | inputSchema={ 762 | "type": "object", 763 | "properties": { 764 | "interval": {"type": "string"}, 765 | "datatype": {"type": "string"}, 766 | }, 767 | "required": [], 768 | }, 769 | ), 770 | types.Tool( 771 | name=AlphavantageTools.CORN.value, 772 | description="Fetch corn", 773 | inputSchema={ 774 | "type": "object", 775 | "properties": { 776 | "interval": {"type": "string"}, 777 | "datatype": {"type": "string"}, 778 | }, 779 | "required": [], 780 | }, 781 | ), 782 | types.Tool( 783 | name=AlphavantageTools.COTTON.value, 784 | description="Fetch cotton", 785 | inputSchema={ 786 | "type": "object", 787 | "properties": { 788 | "interval": {"type": "string"}, 789 | "datatype": {"type": "string"}, 790 | }, 791 | "required": [], 792 | }, 793 | ), 794 | types.Tool( 795 | name=AlphavantageTools.SUGAR.value, 796 | description="Fetch sugar", 797 | inputSchema={ 798 | "type": "object", 799 | "properties": { 800 | "interval": {"type": "string"}, 801 | "datatype": {"type": "string"}, 802 | }, 803 | "required": [], 804 | }, 805 | ), 806 | types.Tool( 807 | name=AlphavantageTools.COFFEE.value, 808 | description="Fetch coffee", 809 | inputSchema={ 810 | "type": "object", 811 | "properties": { 812 | "interval": {"type": "string"}, 813 | "datatype": {"type": "string"}, 814 | }, 815 | "required": [], 816 | }, 817 | ), 818 | types.Tool( 819 | name=AlphavantageTools.ALL_COMMODITIES.value, 820 | description="Fetch all commodities", 821 | inputSchema={ 822 | "type": "object", 823 | "properties": { 824 | "interval": {"type": "string"}, 825 | "datatype": {"type": "string"}, 826 | }, 827 | "required": [], 828 | }, 829 | ), 830 | types.Tool( 831 | name=AlphavantageTools.REAL_GDP.value, 832 | description="Fetch real GDP", 833 | inputSchema={ 834 | "type": "object", 835 | "properties": { 836 | "interval": {"type": "string"}, 837 | "datatype": {"type": "string"}, 838 | }, 839 | "required": [], 840 | }, 841 | ), 842 | types.Tool( 843 | name=AlphavantageTools.REAL_GDP_PER_CAPITA.value, 844 | description="Fetch real GDP per capita", 845 | inputSchema={ 846 | "type": "object", 847 | "properties": { 848 | "datatype": {"type": "string"}, 849 | }, 850 | "required": [], 851 | }, 852 | ), 853 | types.Tool( 854 | name=AlphavantageTools.TREASURY_YIELD.value, 855 | description="Fetch treasury yield", 856 | inputSchema={ 857 | "type": "object", 858 | "properties": { 859 | "interval": {"type": "string"}, 860 | "maturity": {"type": "string"}, 861 | "datatype": {"type": "string"}, 862 | }, 863 | "required": [], 864 | }, 865 | ), 866 | types.Tool( 867 | name=AlphavantageTools.FEDERAL_FUNDS_RATE.value, 868 | description="Fetch federal funds rate", 869 | inputSchema={ 870 | "type": "object", 871 | "properties": { 872 | "interval": {"type": "string"}, 873 | "datatype": {"type": "string"}, 874 | }, 875 | "required": [], 876 | }, 877 | ), 878 | types.Tool( 879 | name=AlphavantageTools.CPI.value, 880 | description="Fetch consumer price index", 881 | inputSchema={ 882 | "type": "object", 883 | "properties": { 884 | "interval": {"type": "string"}, 885 | "datatype": {"type": "string"}, 886 | }, 887 | "required": [], 888 | }, 889 | ), 890 | types.Tool( 891 | name=AlphavantageTools.INFLATION.value, 892 | description="Fetch inflation", 893 | inputSchema={ 894 | "type": "object", 895 | "properties": { 896 | "datatype": {"type": "string"}, 897 | }, 898 | "required": [], 899 | }, 900 | ), 901 | types.Tool( 902 | name=AlphavantageTools.RETAIL_SALES.value, 903 | description="Fetch retail sales", 904 | inputSchema={ 905 | "type": "object", 906 | "properties": { 907 | "datatype": {"type": "string"}, 908 | }, 909 | "required": [], 910 | }, 911 | ), 912 | types.Tool( 913 | name=AlphavantageTools.DURABLES.value, 914 | description="Fetch durables", 915 | inputSchema={ 916 | "type": "object", 917 | "properties": { 918 | "datatype": {"type": "string"}, 919 | }, 920 | "required": [], 921 | }, 922 | ), 923 | types.Tool( 924 | name=AlphavantageTools.UNEMPLOYMENT.value, 925 | description="Fetch unemployment", 926 | inputSchema={ 927 | "type": "object", 928 | "properties": { 929 | "datatype": {"type": "string"}, 930 | }, 931 | "required": [], 932 | }, 933 | ), 934 | types.Tool( 935 | name=AlphavantageTools.NONFARM_PAYROLL.value, 936 | description="Fetch nonfarm payroll", 937 | inputSchema={ 938 | "type": "object", 939 | "properties": { 940 | "datatype": {"type": "string"}, 941 | }, 942 | "required": [], 943 | }, 944 | ), 945 | types.Tool( 946 | name=AlphavantageTools.SMA.value, 947 | description="Fetch simple moving average", 948 | inputSchema={ 949 | "type": "object", 950 | "properties": { 951 | "symbol": {"type": "string"}, 952 | "interval": {"type": "string"}, 953 | "month": {"type": "string"}, 954 | "time_period": {"type": "number"}, 955 | "series_type": {"type": "string"}, 956 | "datatype": {"type": "string"}, 957 | }, 958 | "required": ["symbol", "interval", "time_period", "series_type"], 959 | }, 960 | ), 961 | types.Tool( 962 | name=AlphavantageTools.EMA.value, 963 | description="Fetch exponential moving average", 964 | inputSchema={ 965 | "type": "object", 966 | "properties": { 967 | "symbol": {"type": "string"}, 968 | "interval": {"type": "string"}, 969 | "month": {"type": "string"}, 970 | "time_period": {"type": "number"}, 971 | "series_type": {"type": "string"}, 972 | "datatype": {"type": "string"}, 973 | }, 974 | "required": ["symbol", "interval", "time_period", "series_type"], 975 | }, 976 | ), 977 | types.Tool( 978 | name=AlphavantageTools.WMA.value, 979 | description="Fetch weighted moving average", 980 | inputSchema={ 981 | "type": "object", 982 | "properties": { 983 | "symbol": {"type": "string"}, 984 | "interval": {"type": "string"}, 985 | "month": {"type": "string"}, 986 | "time_period": {"type": "number"}, 987 | "series_type": {"type": "string"}, 988 | "datatype": {"type": "string"}, 989 | }, 990 | "required": ["symbol", "interval", "time_period", "series_type"], 991 | }, 992 | ), 993 | types.Tool( 994 | name=AlphavantageTools.DEMA.value, 995 | description="Fetch double exponential moving average", 996 | inputSchema={ 997 | "type": "object", 998 | "properties": { 999 | "symbol": {"type": "string"}, 1000 | "interval": {"type": "string"}, 1001 | "month": {"type": "string"}, 1002 | "time_period": {"type": "number"}, 1003 | "series_type": {"type": "string"}, 1004 | "datatype": {"type": "string"}, 1005 | }, 1006 | "required": ["symbol", "interval", "time_period", "series_type"], 1007 | }, 1008 | ), 1009 | types.Tool( 1010 | name=AlphavantageTools.TRIMA.value, 1011 | description="Fetch triangular moving average", 1012 | inputSchema={ 1013 | "type": "object", 1014 | "properties": { 1015 | "symbol": {"type": "string"}, 1016 | "interval": {"type": "string"}, 1017 | "month": {"type": "string"}, 1018 | "time_period": {"type": "number"}, 1019 | "series_type": {"type": "string"}, 1020 | "datatype": {"type": "string"}, 1021 | }, 1022 | "required": ["symbol", "interval", "time_period", "series_type"], 1023 | }, 1024 | ), 1025 | types.Tool( 1026 | name=AlphavantageTools.KAMA.value, 1027 | description="Fetch Kaufman adaptive moving average", 1028 | inputSchema={ 1029 | "type": "object", 1030 | "properties": { 1031 | "symbol": {"type": "string"}, 1032 | "interval": {"type": "string"}, 1033 | "month": {"type": "string"}, 1034 | "time_period": {"type": "number"}, 1035 | "series_type": {"type": "string"}, 1036 | "datatype": {"type": "string"}, 1037 | }, 1038 | }, 1039 | ), 1040 | types.Tool( 1041 | name=AlphavantageTools.MAMA.value, 1042 | description="Fetch MESA adaptive moving average", 1043 | inputSchema={ 1044 | "type": "object", 1045 | "properties": { 1046 | "symbol": {"type": "string"}, 1047 | "interval": {"type": "string"}, 1048 | "month": {"type": "string"}, 1049 | "series_type": {"type": "string"}, 1050 | "fastlimit": {"type": "number"}, 1051 | "slowlimit": {"type": "number"}, 1052 | "datatype": {"type": "string"}, 1053 | }, 1054 | "required": [ 1055 | "symbol", 1056 | "interval", 1057 | "series_type", 1058 | "fastlimit", 1059 | "slowlimit", 1060 | ], 1061 | }, 1062 | ), 1063 | types.Tool( 1064 | name=AlphavantageTools.VWAP.value, 1065 | description="Fetch volume weighted average price", 1066 | inputSchema={ 1067 | "type": "object", 1068 | "properties": { 1069 | "symbol": {"type": "string"}, 1070 | "interval": {"type": "string"}, 1071 | "month": {"type": "string"}, 1072 | "datatype": {"type": "string"}, 1073 | }, 1074 | "required": ["symbol", "interval"], 1075 | }, 1076 | ), 1077 | types.Tool( 1078 | name=AlphavantageTools.T3.value, 1079 | description="Fetch triple exponential moving average", 1080 | inputSchema={ 1081 | "type": "object", 1082 | "properties": { 1083 | "symbol": {"type": "string"}, 1084 | "interval": {"type": "string"}, 1085 | "month": {"type": "string"}, 1086 | "time_period": {"type": "number"}, 1087 | "series_type": {"type": "string"}, 1088 | "datatype": {"type": "string"}, 1089 | }, 1090 | "required": ["symbol", "interval", "time_period", "series_type"], 1091 | }, 1092 | ), 1093 | types.Tool( 1094 | name=AlphavantageTools.MACD.value, 1095 | description="Fetch moving average convergence divergence", 1096 | inputSchema={ 1097 | "type": "object", 1098 | "properties": { 1099 | "symbol": {"type": "string"}, 1100 | "interval": {"type": "string"}, 1101 | "month": {"type": "string"}, 1102 | "series_type": {"type": "string"}, 1103 | "fastperiod": {"type": "number"}, 1104 | "slowperiod": {"type": "number"}, 1105 | "signalperiod": {"type": "number"}, 1106 | "datatype": {"type": "string"}, 1107 | }, 1108 | "required": ["symbol", "interval", "series_type"], 1109 | }, 1110 | ), 1111 | types.Tool( 1112 | name=AlphavantageTools.MACDEXT.value, 1113 | description="Fetch moving average convergence divergence next", 1114 | inputSchema={ 1115 | "type": "object", 1116 | "properties": { 1117 | "symbol": {"type": "string"}, 1118 | "interval": {"type": "string"}, 1119 | "month": {"type": "string"}, 1120 | "series_type": {"type": "string"}, 1121 | "fastperiod": {"type": "number"}, 1122 | "slowperiod": {"type": "number"}, 1123 | "signalperiod": {"type": "number"}, 1124 | "fastmatype": {"type": "number"}, 1125 | "slowmatype": {"type": "number"}, 1126 | "signalmatype": {"type": "number"}, 1127 | "datatype": {"type": "string"}, 1128 | }, 1129 | "required": ["symbol", "interval", "series_type"], 1130 | }, 1131 | ), 1132 | types.Tool( 1133 | name=AlphavantageTools.STOCH.value, 1134 | description="Fetch stochastic oscillator", 1135 | inputSchema={ 1136 | "type": "object", 1137 | "properties": { 1138 | "symbol": {"type": "string"}, 1139 | "interval": {"type": "string"}, 1140 | "month": {"type": "string"}, 1141 | "fastkperiod": {"type": "number"}, 1142 | "slowkperiod": {"type": "number"}, 1143 | "slowdperiod": {"type": "number"}, 1144 | "slowkmatype": {"type": "string"}, 1145 | "slowdmatype": {"type": "string"}, 1146 | "datatype": {"type": "string"}, 1147 | }, 1148 | "required": ["symbol", "interval"], 1149 | }, 1150 | ), 1151 | types.Tool( 1152 | name=AlphavantageTools.STOCHF.value, 1153 | description="Fetch stochastic oscillator fast", 1154 | inputSchema={ 1155 | "type": "object", 1156 | "properties": { 1157 | "symbol": {"type": "string"}, 1158 | "interval": {"type": "string"}, 1159 | "month": {"type": "string"}, 1160 | "fastkperiod": {"type": "number"}, 1161 | "fastdperiod": {"type": "number"}, 1162 | "fastdmatype": {"type": "string"}, 1163 | "datatype": {"type": "string"}, 1164 | }, 1165 | "required": ["symbol", "interval"], 1166 | }, 1167 | ), 1168 | types.Tool( 1169 | name=AlphavantageTools.RSI.value, 1170 | description="Fetch relative strength index", 1171 | inputSchema={ 1172 | "type": "object", 1173 | "properties": { 1174 | "symbol": {"type": "string"}, 1175 | "interval": {"type": "string"}, 1176 | "month": {"type": "string"}, 1177 | "time_period": {"type": "number"}, 1178 | "series_type": {"type": "string"}, 1179 | "datatype": {"type": "string"}, 1180 | }, 1181 | "required": ["symbol", "interval", "time_period", "series_type"], 1182 | }, 1183 | ), 1184 | types.Tool( 1185 | name=AlphavantageTools.STOCHRSI.value, 1186 | description="Fetch stochastic relative strength index", 1187 | inputSchema={ 1188 | "type": "object", 1189 | "properties": { 1190 | "symbol": {"type": "string"}, 1191 | "interval": {"type": "string"}, 1192 | "month": {"type": "string"}, 1193 | "time_period": {"type": "number"}, 1194 | "series_type": {"type": "string"}, 1195 | "fastkperiod": {"type": "number"}, 1196 | "fastdperiod": {"type": "number"}, 1197 | "fastdmatype": {"type": "string"}, 1198 | "datatype": {"type": "string"}, 1199 | }, 1200 | "required": ["symbol", "interval", "time_period", "series_type"], 1201 | }, 1202 | ), 1203 | types.Tool( 1204 | name=AlphavantageTools.WILLR.value, 1205 | description="Fetch williams percent range", 1206 | inputSchema={ 1207 | "type": "object", 1208 | "properties": { 1209 | "symbol": {"type": "string"}, 1210 | "interval": {"type": "string"}, 1211 | "month": {"type": "string"}, 1212 | "time_period": {"type": "number"}, 1213 | "datatype": {"type": "string"}, 1214 | }, 1215 | "required": ["symbol", "interval", "time_period"], 1216 | }, 1217 | ), 1218 | types.Tool( 1219 | name=AlphavantageTools.ADX.value, 1220 | description="Fetch average directional movement index", 1221 | inputSchema={ 1222 | "type": "object", 1223 | "properties": { 1224 | "symbol": {"type": "string"}, 1225 | "interval": {"type": "string"}, 1226 | "month": {"type": "string"}, 1227 | "time_period": {"type": "number"}, 1228 | "datatype": {"type": "string"}, 1229 | }, 1230 | "required": ["symbol", "interval", "time_period"], 1231 | }, 1232 | ), 1233 | types.Tool( 1234 | name=AlphavantageTools.ADXR.value, 1235 | description="Fetch average directional movement index rating", 1236 | inputSchema={ 1237 | "type": "object", 1238 | "properties": { 1239 | "symbol": {"type": "string"}, 1240 | "interval": {"type": "string"}, 1241 | "month": {"type": "string"}, 1242 | "time_period": {"type": "number"}, 1243 | "datatype": {"type": "string"}, 1244 | }, 1245 | "required": ["symbol", "interval", "time_period"], 1246 | }, 1247 | ), 1248 | types.Tool( 1249 | name=AlphavantageTools.APO.value, 1250 | description="Fetch absolute price oscillator", 1251 | inputSchema={ 1252 | "type": "object", 1253 | "properties": { 1254 | "symbol": {"type": "string"}, 1255 | "interval": {"type": "string"}, 1256 | "month": {"type": "string"}, 1257 | "series_type": {"type": "string"}, 1258 | "fastperiod": {"type": "number"}, 1259 | "slowperiod": {"type": "number"}, 1260 | "matype": {"type": "string"}, 1261 | "datatype": {"type": "string"}, 1262 | }, 1263 | "required": [ 1264 | "symbol", 1265 | "interval", 1266 | "series_type", 1267 | "fastperiod", 1268 | "slowperiod", 1269 | ], 1270 | }, 1271 | ), 1272 | types.Tool( 1273 | name=AlphavantageTools.PPO.value, 1274 | description="Fetch percentage price oscillator", 1275 | inputSchema={ 1276 | "type": "object", 1277 | "properties": { 1278 | "symbol": {"type": "string"}, 1279 | "interval": {"type": "string"}, 1280 | "month": {"type": "string"}, 1281 | "series_type": {"type": "string"}, 1282 | "fastperiod": {"type": "number"}, 1283 | "slowperiod": {"type": "number"}, 1284 | "matype": {"type": "string"}, 1285 | "datatype": {"type": "string"}, 1286 | }, 1287 | "required": [ 1288 | "symbol", 1289 | "interval", 1290 | "series_type", 1291 | "fastperiod", 1292 | "slowperiod", 1293 | ], 1294 | }, 1295 | ), 1296 | types.Tool( 1297 | name=AlphavantageTools.MOM.value, 1298 | description="Fetch momentum", 1299 | inputSchema={ 1300 | "type": "object", 1301 | "properties": { 1302 | "symbol": {"type": "string"}, 1303 | "interval": {"type": "string"}, 1304 | "month": {"type": "string"}, 1305 | "time_period": {"type": "number"}, 1306 | "series_type": {"type": "string"}, 1307 | "datatype": {"type": "string"}, 1308 | }, 1309 | "required": ["symbol", "interval", "time_period", "series_type"], 1310 | }, 1311 | ), 1312 | types.Tool( 1313 | name=AlphavantageTools.BOP.value, 1314 | description="Fetch balance of power", 1315 | inputSchema={ 1316 | "type": "object", 1317 | "properties": { 1318 | "symbol": {"type": "string"}, 1319 | "interval": {"type": "string"}, 1320 | "month": {"type": "string"}, 1321 | "datatype": {"type": "string"}, 1322 | }, 1323 | "required": ["symbol", "interval"], 1324 | }, 1325 | ), 1326 | types.Tool( 1327 | name=AlphavantageTools.CCI.value, 1328 | description="Fetch commodity channel index", 1329 | inputSchema={ 1330 | "type": "object", 1331 | "properties": { 1332 | "symbol": {"type": "string"}, 1333 | "interval": {"type": "string"}, 1334 | "month": {"type": "string"}, 1335 | "time_period": {"type": "number"}, 1336 | "datatype": {"type": "string"}, 1337 | }, 1338 | "required": ["symbol", "interval", "time_period"], 1339 | }, 1340 | ), 1341 | types.Tool( 1342 | name=AlphavantageTools.CMO.value, 1343 | description="Fetch chande momentum oscillator", 1344 | inputSchema={ 1345 | "type": "object", 1346 | "properties": { 1347 | "symbol": {"type": "string"}, 1348 | "interval": {"type": "string"}, 1349 | "month": {"type": "string"}, 1350 | "time_period": {"type": "number"}, 1351 | "datatype": {"type": "string"}, 1352 | }, 1353 | "required": ["symbol", "interval", "time_period"], 1354 | }, 1355 | ), 1356 | types.Tool( 1357 | name=AlphavantageTools.ROC.value, 1358 | description="Fetch rate of change", 1359 | inputSchema={ 1360 | "type": "object", 1361 | "properties": { 1362 | "symbol": {"type": "string"}, 1363 | "interval": {"type": "string"}, 1364 | "month": {"type": "string"}, 1365 | "time_period": {"type": "number"}, 1366 | "series_type": {"type": "string"}, 1367 | "datatype": {"type": "string"}, 1368 | }, 1369 | "required": ["symbol", "interval", "time_period", "series_type"], 1370 | }, 1371 | ), 1372 | types.Tool( 1373 | name=AlphavantageTools.ROCR.value, 1374 | description="Fetch rate of change ratio", 1375 | inputSchema={ 1376 | "type": "object", 1377 | "properties": { 1378 | "symbol": {"type": "string"}, 1379 | "interval": {"type": "string"}, 1380 | "month": {"type": "string"}, 1381 | "time_period": {"type": "number"}, 1382 | "series_type": {"type": "string"}, 1383 | "datatype": {"type": "string"}, 1384 | }, 1385 | "required": ["symbol", "interval", "time_period", "series_type"], 1386 | }, 1387 | ), 1388 | types.Tool( 1389 | name=AlphavantageTools.AROON.value, 1390 | description="Fetch aroon", 1391 | inputSchema={ 1392 | "type": "object", 1393 | "properties": { 1394 | "symbol": {"type": "string"}, 1395 | "interval": {"type": "string"}, 1396 | "month": {"type": "string"}, 1397 | "time_period": {"type": "number"}, 1398 | "datatype": {"type": "string"}, 1399 | }, 1400 | "required": ["symbol", "interval", "time_period"], 1401 | }, 1402 | ), 1403 | types.Tool( 1404 | name=AlphavantageTools.AROONOSC.value, 1405 | description="Fetch aroon oscillator", 1406 | inputSchema={ 1407 | "type": "object", 1408 | "properties": { 1409 | "symbol": {"type": "string"}, 1410 | "interval": {"type": "string"}, 1411 | "month": {"type": "string"}, 1412 | "time_period": {"type": "number"}, 1413 | "datatype": {"type": "string"}, 1414 | }, 1415 | "required": ["symbol", "interval", "time_period"], 1416 | }, 1417 | ), 1418 | types.Tool( 1419 | name=AlphavantageTools.MFI.value, 1420 | description="Fetch money flow index", 1421 | inputSchema={ 1422 | "type": "object", 1423 | "properties": { 1424 | "symbol": {"type": "string"}, 1425 | "interval": {"type": "string"}, 1426 | "month": {"type": "string"}, 1427 | "time_period": {"type": "number"}, 1428 | "datatype": {"type": "string"}, 1429 | }, 1430 | "required": ["symbol", "interval", "time_period"], 1431 | }, 1432 | ), 1433 | types.Tool( 1434 | name=AlphavantageTools.TRIX.value, 1435 | description="Fetch triple exponential average", 1436 | inputSchema={ 1437 | "type": "object", 1438 | "properties": { 1439 | "symbol": {"type": "string"}, 1440 | "interval": {"type": "string"}, 1441 | "month": {"type": "string"}, 1442 | "time_period": {"type": "number"}, 1443 | "series_type": {"type": "string"}, 1444 | "datatype": {"type": "string"}, 1445 | }, 1446 | "required": ["symbol", "interval", "time_period", "series_type"], 1447 | }, 1448 | ), 1449 | types.Tool( 1450 | name=AlphavantageTools.ULTOSC.value, 1451 | description="Fetch ultimate oscillator", 1452 | inputSchema={ 1453 | "type": "object", 1454 | "properties": { 1455 | "symbol": {"type": "string"}, 1456 | "interval": {"type": "string"}, 1457 | "month": {"type": "string"}, 1458 | "timeperiod1": {"type": "number"}, 1459 | "timeperiod2": {"type": "number"}, 1460 | "timeperiod3": {"type": "number"}, 1461 | "datatype": {"type": "string"}, 1462 | }, 1463 | "required": [ 1464 | "symbol", 1465 | "interval", 1466 | "timeperiod1", 1467 | "timeperiod2", 1468 | "timeperiod3", 1469 | ], 1470 | }, 1471 | ), 1472 | types.Tool( 1473 | name=AlphavantageTools.DX.value, 1474 | description="Fetch directional movement index", 1475 | inputSchema={ 1476 | "type": "object", 1477 | "properties": { 1478 | "symbol": {"type": "string"}, 1479 | "interval": {"type": "string"}, 1480 | "month": {"type": "string"}, 1481 | "time_period": {"type": "number"}, 1482 | "datatype": {"type": "string"}, 1483 | }, 1484 | "required": ["symbol", "interval", "time_period"], 1485 | }, 1486 | ), 1487 | types.Tool( 1488 | name=AlphavantageTools.MINUS_DI.value, 1489 | description="Fetch minus directional indicator", 1490 | inputSchema={ 1491 | "type": "object", 1492 | "properties": { 1493 | "symbol": {"type": "string"}, 1494 | "interval": {"type": "string"}, 1495 | "month": {"type": "string"}, 1496 | "time_period": {"type": "number"}, 1497 | "datatype": {"type": "string"}, 1498 | }, 1499 | "required": ["symbol", "interval", "time_period"], 1500 | }, 1501 | ), 1502 | types.Tool( 1503 | name=AlphavantageTools.PLUS_DI.value, 1504 | description="Fetch plus directional indicator", 1505 | inputSchema={ 1506 | "type": "object", 1507 | "properties": { 1508 | "symbol": {"type": "string"}, 1509 | "interval": {"type": "string"}, 1510 | "month": {"type": "string"}, 1511 | "time_period": {"type": "number"}, 1512 | "datatype": {"type": "string"}, 1513 | }, 1514 | "required": ["symbol", "interval", "time_period"], 1515 | }, 1516 | ), 1517 | types.Tool( 1518 | name=AlphavantageTools.MINUS_DM.value, 1519 | description="Fetch minus directional movement", 1520 | inputSchema={ 1521 | "type": "object", 1522 | "properties": { 1523 | "symbol": {"type": "string"}, 1524 | "interval": {"type": "string"}, 1525 | "month": {"type": "string"}, 1526 | "time_period": {"type": "number"}, 1527 | "datatype": {"type": "string"}, 1528 | }, 1529 | "required": ["symbol", "interval", "time_period"], 1530 | }, 1531 | ), 1532 | types.Tool( 1533 | name=AlphavantageTools.PLUS_DM.value, 1534 | description="Fetch plus directional movement", 1535 | inputSchema={ 1536 | "type": "object", 1537 | "properties": { 1538 | "symbol": {"type": "string"}, 1539 | "interval": {"type": "string"}, 1540 | "month": {"type": "string"}, 1541 | "time_period": {"type": "number"}, 1542 | "datatype": {"type": "string"}, 1543 | }, 1544 | "required": ["symbol", "interval", "time_period"], 1545 | }, 1546 | ), 1547 | types.Tool( 1548 | name=AlphavantageTools.BBANDS.value, 1549 | description="Fetch bollinger bands", 1550 | inputSchema={ 1551 | "type": "object", 1552 | "properties": { 1553 | "symbol": {"type": "string"}, 1554 | "interval": {"type": "string"}, 1555 | "month": {"type": "string"}, 1556 | "time_period": {"type": "number"}, 1557 | "series_type": {"type": "string"}, 1558 | "nbdevup": {"type": "number"}, 1559 | "nbdevdn": {"type": "number"}, 1560 | "datatype": {"type": "string"}, 1561 | }, 1562 | "required": [ 1563 | "symbol", 1564 | "interval", 1565 | "time_period", 1566 | "series_type", 1567 | "nbdevup", 1568 | "nbdevdn", 1569 | ], 1570 | }, 1571 | ), 1572 | types.Tool( 1573 | name=AlphavantageTools.MIDPOINT.value, 1574 | description="Fetch midpoint", 1575 | inputSchema={ 1576 | "type": "object", 1577 | "properties": { 1578 | "symbol": {"type": "string"}, 1579 | "interval": {"type": "string"}, 1580 | "month": {"type": "string"}, 1581 | "time_period": {"type": "number"}, 1582 | "series_type": {"type": "string"}, 1583 | "datatype": {"type": "string"}, 1584 | }, 1585 | "required": ["symbol", "interval", "time_period", "series_type"], 1586 | }, 1587 | ), 1588 | types.Tool( 1589 | name=AlphavantageTools.MIDPRICE.value, 1590 | description="Fetch midprice", 1591 | inputSchema={ 1592 | "type": "object", 1593 | "properties": { 1594 | "symbol": {"type": "string"}, 1595 | "interval": {"type": "string"}, 1596 | "month": {"type": "string"}, 1597 | "time_period": {"type": "number"}, 1598 | "datatype": {"type": "string"}, 1599 | }, 1600 | "required": ["symbol", "interval", "time_period"], 1601 | }, 1602 | ), 1603 | types.Tool( 1604 | name=AlphavantageTools.SAR.value, 1605 | description="Fetch parabolic sar", 1606 | inputSchema={ 1607 | "type": "object", 1608 | "properties": { 1609 | "symbol": {"type": "string"}, 1610 | "interval": {"type": "string"}, 1611 | "month": {"type": "string"}, 1612 | "acceleration": {"type": "number"}, 1613 | "maximum": {"type": "number"}, 1614 | "datatype": {"type": "string"}, 1615 | }, 1616 | "required": ["symbol", "interval"], 1617 | }, 1618 | ), 1619 | types.Tool( 1620 | name=AlphavantageTools.TRANGE.value, 1621 | description="Fetch true range", 1622 | inputSchema={ 1623 | "type": "object", 1624 | "properties": { 1625 | "symbol": {"type": "string"}, 1626 | "interval": {"type": "string"}, 1627 | "month": {"type": "string"}, 1628 | "datatype": {"type": "string"}, 1629 | }, 1630 | "required": ["symbol", "interval"], 1631 | }, 1632 | ), 1633 | types.Tool( 1634 | name=AlphavantageTools.ATR.value, 1635 | description="Fetch average true range", 1636 | inputSchema={ 1637 | "type": "object", 1638 | "properties": { 1639 | "symbol": {"type": "string"}, 1640 | "interval": {"type": "string"}, 1641 | "month": {"type": "string"}, 1642 | "time_period": {"type": "number"}, 1643 | "datatype": {"type": "string"}, 1644 | }, 1645 | "required": ["symbol", "interval", "time_period"], 1646 | }, 1647 | ), 1648 | types.Tool( 1649 | name=AlphavantageTools.NATR.value, 1650 | description="Fetch normalized average true range", 1651 | inputSchema={ 1652 | "type": "object", 1653 | "properties": { 1654 | "symbol": {"type": "string"}, 1655 | "interval": {"type": "string"}, 1656 | "month": {"type": "string"}, 1657 | "time_period": {"type": "number"}, 1658 | "datatype": {"type": "string"}, 1659 | }, 1660 | "required": ["symbol", "interval", "time_period"], 1661 | }, 1662 | ), 1663 | types.Tool( 1664 | name=AlphavantageTools.AD.value, 1665 | description="Fetch accumulation/distribution line", 1666 | inputSchema={ 1667 | "type": "object", 1668 | "properties": { 1669 | "symbol": {"type": "string"}, 1670 | "interval": {"type": "string"}, 1671 | "month": {"type": "string"}, 1672 | "datatype": {"type": "string"}, 1673 | }, 1674 | "required": ["symbol", "interval"], 1675 | }, 1676 | ), 1677 | types.Tool( 1678 | name=AlphavantageTools.ADOSC.value, 1679 | description="Fetch accumulation/distribution oscillator", 1680 | inputSchema={ 1681 | "type": "object", 1682 | "properties": { 1683 | "symbol": {"type": "string"}, 1684 | "interval": {"type": "string"}, 1685 | "month": {"type": "string"}, 1686 | "fastperiod": {"type": "number"}, 1687 | "slowperiod": {"type": "number"}, 1688 | "datatype": {"type": "string"}, 1689 | }, 1690 | "required": ["symbol", "interval", "fastperiod", "slowperiod"], 1691 | }, 1692 | ), 1693 | types.Tool( 1694 | name=AlphavantageTools.OBV.value, 1695 | description="Fetch on balance volume", 1696 | inputSchema={ 1697 | "type": "object", 1698 | "properties": { 1699 | "symbol": {"type": "string"}, 1700 | "interval": {"type": "string"}, 1701 | "month": {"type": "string"}, 1702 | "datatype": {"type": "string"}, 1703 | }, 1704 | "required": ["symbol", "interval"], 1705 | }, 1706 | ), 1707 | types.Tool( 1708 | name=AlphavantageTools.HT_TRENDLINE.value, 1709 | description="Fetch hilbert transform - trendline", 1710 | inputSchema={ 1711 | "type": "object", 1712 | "properties": { 1713 | "symbol": {"type": "string"}, 1714 | "interval": {"type": "string"}, 1715 | "month": {"type": "string"}, 1716 | "series_type": {"type": "string"}, 1717 | "datatype": {"type": "string"}, 1718 | }, 1719 | "required": ["symbol", "interval", "series_type"], 1720 | }, 1721 | ), 1722 | types.Tool( 1723 | name=AlphavantageTools.HT_SINE.value, 1724 | description="Fetch hilbert transform - sine wave", 1725 | inputSchema={ 1726 | "type": "object", 1727 | "properties": { 1728 | "symbol": {"type": "string"}, 1729 | "interval": {"type": "string"}, 1730 | "month": {"type": "string"}, 1731 | "series_type": {"type": "string"}, 1732 | "datatype": {"type": "string"}, 1733 | }, 1734 | "required": ["symbol", "interval", "series_type"], 1735 | }, 1736 | ), 1737 | types.Tool( 1738 | name=AlphavantageTools.HT_TRENDMODE.value, 1739 | description="Fetch hilbert transform - trend mode", 1740 | inputSchema={ 1741 | "type": "object", 1742 | "properties": { 1743 | "symbol": {"type": "string"}, 1744 | "interval": {"type": "string"}, 1745 | "month": {"type": "string"}, 1746 | "datatype": {"type": "string"}, 1747 | }, 1748 | "required": ["symbol", "interval"], 1749 | }, 1750 | ), 1751 | types.Tool( 1752 | name=AlphavantageTools.HT_DCPERIOD.value, 1753 | description="Fetch hilbert transform - dominant cycle period", 1754 | inputSchema={ 1755 | "type": "object", 1756 | "properties": { 1757 | "symbol": {"type": "string"}, 1758 | "interval": {"type": "string"}, 1759 | "month": {"type": "string"}, 1760 | "series_type": {"type": "string"}, 1761 | "datatype": {"type": "string"}, 1762 | }, 1763 | "required": ["symbol", "interval"], 1764 | }, 1765 | ), 1766 | types.Tool( 1767 | name=AlphavantageTools.HT_DCPHASE.value, 1768 | description="Fetch hilbert transform - dominant cycle phase", 1769 | inputSchema={ 1770 | "type": "object", 1771 | "properties": { 1772 | "symbol": {"type": "string"}, 1773 | "interval": {"type": "string"}, 1774 | "month": {"type": "string"}, 1775 | "datatype": {"type": "string"}, 1776 | }, 1777 | "required": ["symbol", "interval"], 1778 | }, 1779 | ), 1780 | types.Tool( 1781 | name=AlphavantageTools.HT_PHASOR.value, 1782 | description="Fetch hilbert transform - phasor components", 1783 | inputSchema={ 1784 | "type": "object", 1785 | "properties": { 1786 | "symbol": {"type": "string"}, 1787 | "interval": {"type": "string"}, 1788 | "month": {"type": "string"}, 1789 | "datatype": {"type": "string"}, 1790 | }, 1791 | "required": ["symbol", "interval"], 1792 | }, 1793 | ), 1794 | ] 1795 | 1796 | 1797 | @server.call_tool() 1798 | async def handle_call_tool( 1799 | name: str, arguments: dict | None 1800 | ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 1801 | """ 1802 | Handle tool execution requests. 1803 | Tools can modify server state and notify clients of changes. 1804 | """ 1805 | try: 1806 | match name: 1807 | case AlphavantageTools.STOCK_QUOTE.value: 1808 | symbol = arguments.get("symbol") 1809 | if not symbol: 1810 | raise ValueError("Missing required argument: symbol") 1811 | 1812 | datatype = arguments.get("datatype", "json") 1813 | result = await fetch_quote(symbol, datatype) 1814 | case AlphavantageTools.TIME_SERIES_INTRADAY.value: 1815 | symbol = arguments.get("symbol") 1816 | interval = arguments.get("interval") 1817 | if not symbol or not interval: 1818 | raise ValueError("Missing required arguments: symbol, interval") 1819 | 1820 | datatype = arguments.get("datatype", "json") 1821 | adjusted = arguments.get("adjusted", True) 1822 | extended_hours = arguments.get("extended_hours", True) 1823 | outputsize = arguments.get("outputsize", "compact") 1824 | month = arguments.get("month", None) 1825 | 1826 | result = await fetch_intraday( 1827 | symbol, 1828 | interval, 1829 | datatype, 1830 | extended_hours, 1831 | adjusted, 1832 | outputsize, 1833 | month, 1834 | ) 1835 | case AlphavantageTools.TIME_SERIES_DAILY.value: 1836 | symbol = arguments.get("symbol") 1837 | if not symbol: 1838 | raise ValueError("Missing required argument: symbol") 1839 | 1840 | datatype = arguments.get("datatype", "json") 1841 | outputsize = arguments.get("outputsize", "compact") 1842 | 1843 | result = await fetch_time_series_daily(symbol, datatype, outputsize) 1844 | case AlphavantageTools.TIME_SERIES_DAILY_ADJUSTED.value: 1845 | symbol = arguments.get("symbol") 1846 | if not symbol: 1847 | raise ValueError("Missing required argument: symbol") 1848 | 1849 | datatype = arguments.get("datatype", "json") 1850 | outputsize = arguments.get("outputsize", "compact") 1851 | 1852 | result = await fetch_time_series_daily_adjusted( 1853 | symbol, datatype, outputsize 1854 | ) 1855 | case AlphavantageTools.TIME_SERIES_WEEKLY.value: 1856 | symbol = arguments.get("symbol") 1857 | if not symbol: 1858 | raise ValueError("Missing required argument: symbol") 1859 | 1860 | datatype = arguments.get("datatype", "json") 1861 | 1862 | result = await fetch_time_series_weekly(symbol, datatype) 1863 | case AlphavantageTools.TIME_SERIES_WEEKLY_ADJUSTED.value: 1864 | symbol = arguments.get("symbol") 1865 | if not symbol: 1866 | raise ValueError("Missing required argument: symbol") 1867 | 1868 | datatype = arguments.get("datatype", "json") 1869 | 1870 | result = await fetch_time_series_weekly_adjusted(symbol, datatype) 1871 | case AlphavantageTools.TIME_SERIES_MONTHLY.value: 1872 | symbol = arguments.get("symbol") 1873 | if not symbol: 1874 | raise ValueError("Missing required argument: symbol") 1875 | 1876 | datatype = arguments.get("datatype", "json") 1877 | 1878 | result = await fetch_time_series_monthly(symbol, datatype) 1879 | case AlphavantageTools.TIME_SERIES_MONTHLY_ADJUSTED.value: 1880 | symbol = arguments.get("symbol") 1881 | if not symbol: 1882 | raise ValueError("Missing required argument: symbol") 1883 | 1884 | datatype = arguments.get("datatype", "json") 1885 | 1886 | result = await fetch_time_series_monthly_adjusted(symbol, datatype) 1887 | 1888 | case AlphavantageTools.REALTIME_BULK_QUOTES.value: 1889 | symbols = arguments.get("symbols") 1890 | if not symbols: 1891 | raise ValueError("Missing required argument: symbols") 1892 | 1893 | datatype = arguments.get("datatype", "json") 1894 | result = await fetch_realtime_bulk_quotes(symbols, datatype) 1895 | 1896 | case AlphavantageTools.SYMBOL_SEARCH.value: 1897 | keywords = arguments.get("keywords") 1898 | if not keywords: 1899 | raise ValueError("Missing required argument: keywords") 1900 | 1901 | datatype = arguments.get("datatype", "json") 1902 | result = await search_endpoint(keywords, datatype) 1903 | 1904 | case AlphavantageTools.MARKET_STATUS.value: 1905 | result = await fetch_market_status() 1906 | 1907 | case AlphavantageTools.REALTIME_OPTIONS.value: 1908 | symbol = arguments.get("symbol") 1909 | if not symbol: 1910 | raise ValueError("Missing required argument: symbol") 1911 | 1912 | datatype = arguments.get("datatype", "json") 1913 | contract = arguments.get("contract", "all") 1914 | result = await fetch_realtime_options(symbol, datatype, contract) 1915 | 1916 | case AlphavantageTools.HISTORICAL_OPTIONS.value: 1917 | symbol = arguments.get("symbol") 1918 | if not symbol: 1919 | raise ValueError("Missing required argument: symbol") 1920 | 1921 | datatype = arguments.get("datatype", "json") 1922 | contract = arguments.get("contract", "all") 1923 | result = await fetch_historical_options(symbol, datatype, contract) 1924 | 1925 | case AlphavantageTools.NEWS_SENTIMENT.value: 1926 | tickers = arguments.get("tickers", []) 1927 | datatype = arguments.get("datatype", "json") 1928 | topics = arguments.get("topics", None) 1929 | time_from = arguments.get("time_from", None) 1930 | time_to = arguments.get("time_to", None) 1931 | sort = arguments.get("sort", "LATEST") 1932 | limit = arguments.get("limit", 50) 1933 | 1934 | result = await fetch_news_sentiment( 1935 | tickers, datatype, topics, time_from, time_to, sort, limit 1936 | ) 1937 | 1938 | case AlphavantageTools.TOP_GAINERS_LOSERS.value: 1939 | result = await fetch_top_gainer_losers() 1940 | 1941 | case AlphavantageTools.INSIDER_TRANSACTIONS.value: 1942 | symbol = arguments.get("symbol") 1943 | if not symbol: 1944 | raise ValueError("Missing required argument: symbol") 1945 | 1946 | result = await fetch_insider_transactions(symbol) 1947 | 1948 | case AlphavantageTools.ANALYTICS_FIXED_WINDOW.value: 1949 | symbols = arguments.get("symbols") 1950 | interval = arguments.get("interval") 1951 | series_range = arguments.get("series_range") 1952 | ohlc = arguments.get("ohlc", "close") 1953 | calculations = arguments.get("calculations") 1954 | 1955 | if not symbols or not interval or not series_range or not calculations: 1956 | raise ValueError( 1957 | "Missing required arguments: symbols, interval, series_range, calculations" 1958 | ) 1959 | result = await fetch_analytics_fixed_window( 1960 | symbols, interval, series_range, ohlc, calculations 1961 | ) 1962 | 1963 | case AlphavantageTools.ANALYTICS_SLIDING_WINDOW.value: 1964 | symbols = arguments.get("symbols") 1965 | interval = arguments.get("interval") 1966 | series_range = arguments.get("series_range") 1967 | ohlc = arguments.get("ohlc", "close") 1968 | window_size = arguments.get("window_size") 1969 | calculations = arguments.get("calculations", []) 1970 | 1971 | if ( 1972 | not symbols 1973 | or not interval 1974 | or not series_range 1975 | or not calculations 1976 | or not window_size 1977 | ): 1978 | raise ValueError( 1979 | "Missing required arguments: symbols, interval, series_range, calculations, window_size" 1980 | ) 1981 | result = await fetch_analytics_sliding_window( 1982 | symbols, series_range, ohlc, interval, interval, calculations 1983 | ) 1984 | 1985 | case AlphavantageTools.COMPANY_OVERVIEW.value: 1986 | symbol = arguments.get("symbol") 1987 | if not symbol: 1988 | raise ValueError("Missing required argument: symbol") 1989 | 1990 | result = await fetch_company_overview(symbol) 1991 | 1992 | case AlphavantageTools.ETF_PROFILE.value: 1993 | symbol = arguments.get("symbol") 1994 | if not symbol: 1995 | raise ValueError("Missing required argument: symbol") 1996 | 1997 | result = await fetch_etf_profile(symbol) 1998 | 1999 | case AlphavantageTools.COMPANY_DIVIDENDS.value: 2000 | symbol = arguments.get("symbol") 2001 | if not symbol: 2002 | raise ValueError("Missing required argument: symbol") 2003 | 2004 | result = await company_dividends(symbol) 2005 | 2006 | case AlphavantageTools.COMPANY_SPLITS.value: 2007 | symbol = arguments.get("symbol") 2008 | if not symbol: 2009 | raise ValueError("Missing required argument: symbol") 2010 | 2011 | result = await fetch_company_splits(symbol) 2012 | 2013 | case AlphavantageTools.INCOME_STATEMENT.value: 2014 | symbol = arguments.get("symbol") 2015 | if not symbol: 2016 | raise ValueError("Missing required argument: symbol") 2017 | 2018 | result = await fetch_income_statement(symbol) 2019 | case AlphavantageTools.BALANCE_SHEET.value: 2020 | symbol = arguments.get("symbol") 2021 | if not symbol: 2022 | raise ValueError("Missing required argument: symbol") 2023 | 2024 | result = await fetch_balance_sheet(symbol) 2025 | 2026 | case AlphavantageTools.CASH_FLOW.value: 2027 | symbol = arguments.get("symbol") 2028 | if not symbol: 2029 | raise ValueError("Missing required argument: symbol") 2030 | 2031 | result = await fetch_cash_flow(symbol) 2032 | 2033 | case AlphavantageTools.LISTING_STATUS.value: 2034 | symbol = arguments.get("symbol") 2035 | date = arguments.get("date") 2036 | state = arguments.get("state") 2037 | result = await fetch_listing_status(symbol, date, state) 2038 | 2039 | case AlphavantageTools.EARNINGS_CALENDAR.value: 2040 | symbol = arguments.get("symbol") 2041 | horizon = arguments.get("horizon") 2042 | result = await fetch_earnings_calendar(symbol, horizon) 2043 | 2044 | case AlphavantageTools.IPO_CALENDAR.value: 2045 | result = await fetch_ipo_calendar() 2046 | 2047 | case AlphavantageTools.EXCHANGE_RATE.value: 2048 | from_currency = arguments.get("from_currency") 2049 | to_currency = arguments.get("to_currency") 2050 | 2051 | if not from_currency or not to_currency: 2052 | raise ValueError( 2053 | "Missing required arguments: from_currency, to_currency" 2054 | ) 2055 | 2056 | result = await fetch_exchange_rate(from_currency, to_currency) 2057 | 2058 | case AlphavantageTools.FX_INTRADAY.value: 2059 | from_symbol = arguments.get("from_symbol") 2060 | to_symbol = arguments.get("to_symbol") 2061 | interval = arguments.get("interval") 2062 | outputsize = arguments.get("outputsize", "compact") 2063 | datatype = arguments.get("datatype", "json") 2064 | 2065 | if not from_symbol or not to_symbol or not interval: 2066 | raise ValueError( 2067 | "Missing required arguments: from_symbol, to_symbol, interval" 2068 | ) 2069 | 2070 | result = await fetch_fx_intraday( 2071 | from_symbol, to_symbol, interval, outputsize, datatype 2072 | ) 2073 | 2074 | case AlphavantageTools.FX_DAILY.value: 2075 | from_symbol = arguments.get("from_symbol") 2076 | to_symbol = arguments.get("to_symbol") 2077 | datatype = arguments.get("datatype", "json") 2078 | outputsize = arguments.get("outputsize", "compact") 2079 | 2080 | if not from_symbol or not to_symbol: 2081 | raise ValueError( 2082 | "Missing required arguments: from_symbol, to_symbol" 2083 | ) 2084 | 2085 | result = await fetch_fx_daily( 2086 | from_symbol, to_symbol, datatype, outputsize 2087 | ) 2088 | 2089 | case AlphavantageTools.FX_WEEKLY.value: 2090 | from_symbol = arguments.get("from_symbol") 2091 | to_symbol = arguments.get("to_symbol") 2092 | datatype = arguments.get("datatype", "json") 2093 | 2094 | if not from_symbol or not to_symbol: 2095 | raise ValueError( 2096 | "Missing required arguments: from_symbol, to_symbol" 2097 | ) 2098 | 2099 | result = await fetch_fx_weekly(from_symbol, to_symbol, datatype) 2100 | 2101 | case AlphavantageTools.FX_MONTHLY.value: 2102 | from_symbol = arguments.get("from_symbol") 2103 | to_symbol = arguments.get("to_symbol") 2104 | datatype = arguments.get("datatype", "json") 2105 | 2106 | if not from_symbol or not to_symbol: 2107 | raise ValueError( 2108 | "Missing required arguments: from_symbol, to_symbol" 2109 | ) 2110 | 2111 | result = await fetch_fx_monthly(from_symbol, to_symbol, datatype) 2112 | 2113 | case AlphavantageTools.CRYPTO_INTRADAY.value: 2114 | symbol = arguments.get("symbol") 2115 | market = arguments.get("market") 2116 | interval = arguments.get("interval") 2117 | outputsize = arguments.get("outputsize", "compact") 2118 | datatype = arguments.get("datatype", "json") 2119 | 2120 | if not symbol or not market or not interval: 2121 | raise ValueError( 2122 | "Missing required arguments: symbol, market, interval" 2123 | ) 2124 | 2125 | result = await fetch_digital_currency_intraday( 2126 | symbol, market, interval, datatype, outputsize 2127 | ) 2128 | 2129 | case AlphavantageTools.DIGITAL_CURRENCY_DAILY.value: 2130 | symbol = arguments.get("symbol") 2131 | market = arguments.get("market") 2132 | 2133 | if not symbol or not market: 2134 | raise ValueError("Missing required arguments: symbol, market") 2135 | 2136 | result = await fetch_digital_currency_daily(symbol, market) 2137 | 2138 | case AlphavantageTools.DIGITAL_CURRENCY_WEEKLY.value: 2139 | symbol = arguments.get("symbol") 2140 | market = arguments.get("market") 2141 | 2142 | if not symbol or not market: 2143 | raise ValueError("Missing required arguments: symbol, market") 2144 | 2145 | result = await fetch_digital_currency_daily(symbol, market) 2146 | 2147 | case AlphavantageTools.DIGITAL_CURRENCY_MONTHLY.value: 2148 | symbol = arguments.get("symbol") 2149 | market = arguments.get("market") 2150 | 2151 | if not symbol or not market: 2152 | raise ValueError("Missing required arguments: symbol, market") 2153 | 2154 | result = await fetch_digital_currency_monthly(symbol, market) 2155 | 2156 | case AlphavantageTools.WTI_CRUDE_OIL.value: 2157 | interval = arguments.get("interval", "montHly") 2158 | datatype = arguments.get("datatype", "json") 2159 | 2160 | result = await fetch_wti_crude(interval, datatype) 2161 | 2162 | case AlphavantageTools.BRENT_CRUDE_OIL.value: 2163 | interval = arguments.get("interval", "monthly") 2164 | datatype = arguments.get("datatype", "json") 2165 | 2166 | result = await fetch_brent_crude(interval, datatype) 2167 | 2168 | case AlphavantageTools.NATURAL_GAS.value: 2169 | interval = arguments.get("interval", "monthly") 2170 | datatype = arguments.get("datatype", "json") 2171 | 2172 | result = await fetch_natural_gas(interval, datatype) 2173 | 2174 | case AlphavantageTools.COPPER.value: 2175 | interval = arguments.get("interval", "monthly") 2176 | datatype = arguments.get("datatype", "json") 2177 | 2178 | result = await fetch_copper(interval, datatype) 2179 | 2180 | case AlphavantageTools.ALUMINUM.value: 2181 | interval = arguments.get("interval", "monthly") 2182 | datatype = arguments.get("datatype", "json") 2183 | 2184 | result = await fetch_aluminum(interval, datatype) 2185 | 2186 | case AlphavantageTools.WHEAT.value: 2187 | interval = arguments.get("interval", "monthly") 2188 | datatype = arguments.get("datatype", "json") 2189 | 2190 | result = await fetch_wheat(interval, datatype) 2191 | 2192 | case AlphavantageTools.CORN.value: 2193 | interval = arguments.get("interval", "monthly") 2194 | datatype = arguments.get("datatype", "json") 2195 | 2196 | result = await fetch_corn(interval, datatype) 2197 | 2198 | case AlphavantageTools.COTTON.value: 2199 | interval = arguments.get("interval", "monthly") 2200 | datatype = arguments.get("datatype", "json") 2201 | 2202 | result = await fetch_cotton(interval, datatype) 2203 | 2204 | case AlphavantageTools.SUGAR.value: 2205 | interval = arguments.get("interval", "monthly") 2206 | datatype = arguments.get("datatype", "json") 2207 | 2208 | result = await fetch_sugar(interval, datatype) 2209 | 2210 | case AlphavantageTools.COFFEE.value: 2211 | interval = arguments.get("interval", "monthly") 2212 | datatype = arguments.get("datatype", "json") 2213 | 2214 | result = await fetch_coffee(interval, datatype) 2215 | 2216 | case AlphavantageTools.ALL_COMMODITIES.value: 2217 | interval = arguments.get("interval", "monthly") 2218 | datatype = arguments.get("datatype", "json") 2219 | 2220 | result = await fetch_all_commodities(interval, datatype) 2221 | 2222 | case AlphavantageTools.REAL_GDP.value: 2223 | interval = arguments.get("interval", "monthly") 2224 | datatype = arguments.get("datatype", "json") 2225 | 2226 | result = await fetch_real_gdp(interval, datatype) 2227 | 2228 | case AlphavantageTools.REAL_GDP_PER_CAPITA.value: 2229 | datatype = arguments.get("datatype", "json") 2230 | 2231 | result = await fetch_real_gdp_per_capita(datatype) 2232 | 2233 | case AlphavantageTools.TREASURY_YIELD.value: 2234 | interval = arguments.get("interval", "monthly") 2235 | maturity = arguments.get("maturity", "10year") 2236 | datatype = arguments.get("datatype", "json") 2237 | 2238 | result = await fetch_treasury_yield(interval, maturity, datatype) 2239 | 2240 | case AlphavantageTools.FEDERAL_FUNDS_RATE.value: 2241 | interval = arguments.get("interval", "monthly") 2242 | datatype = arguments.get("datatype", "json") 2243 | 2244 | result = await fetch_federal_funds_rate(interval, datatype) 2245 | 2246 | case AlphavantageTools.CPI.value: 2247 | interval = arguments.get("interval", "monthly") 2248 | datatype = arguments.get("datatype", "json") 2249 | 2250 | result = await fetch_cpi(interval, datatype) 2251 | 2252 | case AlphavantageTools.INFLATION.value: 2253 | datatype = arguments.get("datatype", "json") 2254 | 2255 | result = await fetch_inflation(datatype) 2256 | 2257 | case AlphavantageTools.RETAIL_SALES.value: 2258 | datatype = arguments.get("datatype", "json") 2259 | 2260 | result = await fetch_retail_sales(datatype) 2261 | 2262 | case AlphavantageTools.DURABLES.value: 2263 | datatype = arguments.get("datatype", "json") 2264 | 2265 | result = await fetch_durables(datatype) 2266 | 2267 | case AlphavantageTools.UNEMPLOYMENT.value: 2268 | datatype = arguments.get("datatype", "json") 2269 | 2270 | result = await fetch_unemployment(datatype) 2271 | 2272 | case AlphavantageTools.NONFARM_PAYROLL.value: 2273 | datatype = arguments.get("datatype", "json") 2274 | 2275 | result = await fetch_nonfarm_payrolls(datatype) 2276 | 2277 | case AlphavantageTools.SMA.value: 2278 | symbol = arguments.get("symbol") 2279 | interval = arguments.get("interval") 2280 | month = arguments.get("month") 2281 | time_period = arguments.get("time_period") 2282 | series_type = arguments.get("series_type") 2283 | datatype = arguments.get("datatype", "json") 2284 | 2285 | if not symbol or not interval or not time_period or not series_type: 2286 | raise ValueError( 2287 | "Missing required arguments: symbol, interval, time_period, series_type" 2288 | ) 2289 | 2290 | result = await fetch_sma( 2291 | symbol, interval, month, time_period, series_type, datatype 2292 | ) 2293 | 2294 | case AlphavantageTools.EMA.value: 2295 | symbol = arguments.get("symbol") 2296 | interval = arguments.get("interval") 2297 | month = arguments.get("month") 2298 | time_period = arguments.get("time_period") 2299 | series_type = arguments.get("series_type") 2300 | datatype = arguments.get("datatype", "json") 2301 | 2302 | if not symbol or not interval or not time_period or not series_type: 2303 | raise ValueError( 2304 | "Missing required arguments: symbol, interval, time_period, series_type" 2305 | ) 2306 | 2307 | result = await fetch_ema( 2308 | symbol, interval, month, time_period, series_type, datatype 2309 | ) 2310 | 2311 | case AlphavantageTools.WMA.value: 2312 | symbol = arguments.get("symbol") 2313 | interval = arguments.get("interval") 2314 | month = arguments.get("month") 2315 | time_period = arguments.get("time_period") 2316 | series_type = arguments.get("series_type") 2317 | datatype = arguments.get("datatype", "json") 2318 | 2319 | if not symbol or not interval or not time_period or not series_type: 2320 | raise ValueError( 2321 | "Missing required arguments: symbol, interval, time_period, series_type" 2322 | ) 2323 | 2324 | result = await fetch_wma( 2325 | symbol, interval, month, time_period, series_type, datatype 2326 | ) 2327 | 2328 | case AlphavantageTools.DEMA.value: 2329 | symbol = arguments.get("symbol") 2330 | interval = arguments.get("interval") 2331 | month = arguments.get("month") 2332 | time_period = arguments.get("time_period") 2333 | series_type = arguments.get("series_type") 2334 | datatype = arguments.get("datatype", "json") 2335 | 2336 | if not symbol or not interval or not time_period or not series_type: 2337 | raise ValueError( 2338 | "Missing required arguments: symbol, interval, time_period, series_type" 2339 | ) 2340 | 2341 | result = await fetch_dema( 2342 | symbol, interval, month, time_period, series_type, datatype 2343 | ) 2344 | 2345 | case AlphavantageTools.TEMA.value: 2346 | symbol = arguments.get("symbol") 2347 | interval = arguments.get("interval") 2348 | month = arguments.get("month") 2349 | time_period = arguments.get("time_period") 2350 | series_type = arguments.get("series_type") 2351 | datatype = arguments.get("datatype", "json") 2352 | 2353 | if not symbol or not interval or not time_period or not series_type: 2354 | raise ValueError( 2355 | "Missing required arguments: symbol, interval, time_period, series_type" 2356 | ) 2357 | 2358 | result = await fetch_tema( 2359 | symbol, interval, month, time_period, series_type, datatype 2360 | ) 2361 | 2362 | case AlphavantageTools.TRIMA.value: 2363 | symbol = arguments.get("symbol") 2364 | interval = arguments.get("interval") 2365 | month = arguments.get("month") 2366 | time_period = arguments.get("time_period") 2367 | series_type = arguments.get("series_type") 2368 | datatype = arguments.get("datatype", "json") 2369 | 2370 | if not symbol or not interval or not time_period or not series_type: 2371 | raise ValueError( 2372 | "Missing required arguments: symbol, interval, time_period, series_type" 2373 | ) 2374 | 2375 | result = await fetch_trima( 2376 | symbol, interval, month, time_period, series_type, datatype 2377 | ) 2378 | 2379 | case AlphavantageTools.KAMA.value: 2380 | symbol = arguments.get("symbol") 2381 | interval = arguments.get("interval") 2382 | month = arguments.get("month") 2383 | time_period = arguments.get("time_period") 2384 | series_type = arguments.get("series_type") 2385 | datatype = arguments.get("datatype", "json") 2386 | 2387 | if not symbol or not interval or not time_period or not series_type: 2388 | raise ValueError( 2389 | "Missing required arguments: symbol, interval, time_period, series_type" 2390 | ) 2391 | 2392 | result = await fetch_kama( 2393 | symbol, interval, month, time_period, series_type, datatype 2394 | ) 2395 | 2396 | case AlphavantageTools.MAMA.value: 2397 | symbol = arguments.get("symbol") 2398 | interval = arguments.get("interval") 2399 | month = arguments.get("month") 2400 | series_type = arguments.get("series_type") 2401 | fastlimit = arguments.get("fastlimit") 2402 | slowlimit = arguments.get("slowlimit") 2403 | datatype = arguments.get("datatype", "json") 2404 | 2405 | if ( 2406 | not symbol 2407 | or not interval 2408 | or not series_type 2409 | or not fastlimit 2410 | or not slowlimit 2411 | ): 2412 | raise ValueError( 2413 | "Missing required arguments: symbol, interval, series_type, fastlimit, slowlimit" 2414 | ) 2415 | 2416 | result = await fetch_mama( 2417 | symbol, interval, month, series_type, fastlimit, slowlimit, datatype 2418 | ) 2419 | 2420 | case AlphavantageTools.VWAP.value: 2421 | symbol = arguments.get("symbol") 2422 | interval = arguments.get("interval") 2423 | month = arguments.get("month") 2424 | datatype = arguments.get("datatype", "json") 2425 | 2426 | if not symbol or not interval: 2427 | raise ValueError("Missing required arguments: symbol, interval") 2428 | 2429 | result = await fetch_vwap(symbol, interval, month, datatype) 2430 | 2431 | case AlphavantageTools.T3.value: 2432 | symbol = arguments.get("symbol") 2433 | interval = arguments.get("interval") 2434 | month = arguments.get("month") 2435 | time_period = arguments.get("time_period") 2436 | series_type = arguments.get("series_type") 2437 | datatype = arguments.get("datatype", "json") 2438 | 2439 | if not symbol or not interval or not time_period or not series_type: 2440 | raise ValueError( 2441 | "Missing required arguments: symbol, interval, time_period, series_type" 2442 | ) 2443 | 2444 | result = await fetch_t3( 2445 | symbol, interval, month, time_period, series_type, datatype 2446 | ) 2447 | 2448 | case AlphavantageTools.MACD.value: 2449 | symbol = arguments.get("symbol") 2450 | interval = arguments.get("interval") 2451 | month = arguments.get("month") 2452 | series_type = arguments.get("series_type") 2453 | fastperiod = arguments.get("fastperiod", 12) 2454 | slowperiod = arguments.get("slowperiod", 26) 2455 | signalperiod = arguments.get("signalperiod", 9) 2456 | datatype = arguments.get("datatype", "json") 2457 | 2458 | if not symbol or not interval or not series_type: 2459 | raise ValueError( 2460 | "Missing required arguments: symbol, interval, series_type" 2461 | ) 2462 | 2463 | result = await fetch_macd( 2464 | symbol, 2465 | interval, 2466 | month, 2467 | series_type, 2468 | fastperiod, 2469 | slowperiod, 2470 | signalperiod, 2471 | datatype, 2472 | ) 2473 | case AlphavantageTools.MACDEXT.value: 2474 | symbol = arguments.get("symbol") 2475 | interval = arguments.get("interval") 2476 | month = arguments.get("month") 2477 | series_type = arguments.get("series_type") 2478 | fastperiod = arguments.get("fastperiod", 12) 2479 | slowperiod = arguments.get("slowperiod", 26) 2480 | signalperiod = arguments.get("signalperiod", 9) 2481 | fastmatype = arguments.get("fastmatype", 0) 2482 | slowmatype = arguments.get("slowmatype", 0) 2483 | signalmatype = arguments.get("signalmatype", 0) 2484 | datatype = arguments.get("datatype", "json") 2485 | 2486 | if not symbol or not interval or not series_type: 2487 | raise ValueError( 2488 | "Missing required arguments: symbol, interval, series_type" 2489 | ) 2490 | 2491 | result = await fetch_macdext( 2492 | symbol, 2493 | interval, 2494 | month, 2495 | series_type, 2496 | fastperiod, 2497 | slowperiod, 2498 | signalperiod, 2499 | fastmatype, 2500 | slowmatype, 2501 | signalmatype, 2502 | datatype, 2503 | ) 2504 | 2505 | case AlphavantageTools.STOCH.value: 2506 | symbol = arguments.get("symbol") 2507 | interval = arguments.get("interval") 2508 | month = arguments.get("month") 2509 | fastkperiod = arguments.get("fastkperiod", 5) 2510 | slowkperiod = arguments.get("slowkperiod", 3) 2511 | slowdperiod = arguments.get("slowdperiod", 3) 2512 | slowkmatype = arguments.get("slowkmatype", 0) 2513 | slowdmatype = arguments.get("slowdmatype", 0) 2514 | datatype = arguments.get("datatype", "json") 2515 | 2516 | if not symbol or not interval: 2517 | raise ValueError("Missing required arguments: symbol, interval") 2518 | 2519 | result = await fetch_stoch( 2520 | symbol, 2521 | interval, 2522 | month, 2523 | fastkperiod, 2524 | slowkperiod, 2525 | slowdperiod, 2526 | slowkmatype, 2527 | slowdmatype, 2528 | datatype, 2529 | ) 2530 | 2531 | case AlphavantageTools.STOCHF.value: 2532 | symbol = arguments.get("symbol") 2533 | interval = arguments.get("interval") 2534 | month = arguments.get("month") 2535 | fastkperiod = arguments.get("fastkperiod", 5) 2536 | fastdperiod = arguments.get("fastdperiod", 3) 2537 | fastdmatype = arguments.get("fastdmatype", 0) 2538 | datatype = arguments.get("datatype", "json") 2539 | 2540 | if not symbol or not interval: 2541 | raise ValueError("Missing required arguments: symbol, interval") 2542 | 2543 | result = await fetch_stochf( 2544 | symbol, 2545 | interval, 2546 | month, 2547 | fastkperiod, 2548 | fastdperiod, 2549 | fastdmatype, 2550 | datatype, 2551 | ) 2552 | 2553 | case AlphavantageTools.RSI.value: 2554 | symbol = arguments.get("symbol") 2555 | interval = arguments.get("interval") 2556 | month = arguments.get("month") 2557 | time_period = arguments.get("time_period", 14) 2558 | series_type = arguments.get("series_type") 2559 | datatype = arguments.get("datatype", "json") 2560 | 2561 | if not symbol or not interval or not series_type: 2562 | raise ValueError( 2563 | "Missing required arguments: symbol, interval, series_type" 2564 | ) 2565 | 2566 | result = await fetch_rsi( 2567 | symbol, interval, month, time_period, series_type, datatype 2568 | ) 2569 | 2570 | case AlphavantageTools.STOCHRSI.value: 2571 | symbol = arguments.get("symbol") 2572 | interval = arguments.get("interval") 2573 | month = arguments.get("month") 2574 | time_period = arguments.get("time_period", 14) 2575 | series_type = arguments.get("series_type") 2576 | fastkperiod = arguments.get("fastkperiod", 5) 2577 | fastdperiod = arguments.get("fastdperiod", 3) 2578 | fastdmatype = arguments.get("fastdmatype", 0) 2579 | datatype = arguments.get("datatype", "json") 2580 | 2581 | if not symbol or not interval or not time_period or not series_type: 2582 | raise ValueError( 2583 | "Missing required arguments: symbol, interval, time_period, series_type" 2584 | ) 2585 | 2586 | result = await fetch_stochrsi( 2587 | symbol, 2588 | interval, 2589 | month, 2590 | time_period, 2591 | series_type, 2592 | fastkperiod, 2593 | fastdperiod, 2594 | fastdmatype, 2595 | datatype, 2596 | ) 2597 | 2598 | case AlphavantageTools.WILLR.value: 2599 | symbol = arguments.get("symbol") 2600 | interval = arguments.get("interval") 2601 | month = arguments.get("month") 2602 | time_period = arguments.get("time_period", 14) 2603 | datatype = arguments.get("datatype", "json") 2604 | 2605 | if not symbol or not interval: 2606 | raise ValueError( 2607 | "Missing required arguments: symbol, interval, time_period" 2608 | ) 2609 | 2610 | result = await fetch_willr( 2611 | symbol, interval, month, time_period, datatype 2612 | ) 2613 | 2614 | case AlphavantageTools.ADX.value: 2615 | symbol = arguments.get("symbol") 2616 | interval = arguments.get("interval") 2617 | month = arguments.get("month") 2618 | time_period = arguments.get("time_period", 14) 2619 | datatype = arguments.get("datatype", "json") 2620 | 2621 | if not symbol or not interval: 2622 | raise ValueError( 2623 | "Missing required arguments: symbol, interval, time_period" 2624 | ) 2625 | 2626 | result = await fetch_adx(symbol, interval, month, time_period, datatype) 2627 | 2628 | case AlphavantageTools.ADXR.value: 2629 | symbol = arguments.get("symbol") 2630 | interval = arguments.get("interval") 2631 | month = arguments.get("month") 2632 | time_period = arguments.get("time_period", 14) 2633 | datatype = arguments.get("datatype", "json") 2634 | 2635 | if not symbol or not interval: 2636 | raise ValueError( 2637 | "Missing required arguments: symbol, interval, time_period" 2638 | ) 2639 | 2640 | result = await fetch_adxr( 2641 | symbol, interval, month, time_period, datatype 2642 | ) 2643 | 2644 | case AlphavantageTools.APO.value: 2645 | symbol = arguments.get("symbol") 2646 | interval = arguments.get("interval") 2647 | month = arguments.get("month") 2648 | series_type = arguments.get("series_type") 2649 | fastperiod = arguments.get("fastperiod", 12) 2650 | slowperiod = arguments.get("slowperiod", 26) 2651 | matype = arguments.get("matype", 0) 2652 | datatype = arguments.get("datatype", "json") 2653 | 2654 | if not symbol or not interval or not series_type: 2655 | raise ValueError( 2656 | "Missing required arguments: symbol, interval, series_type" 2657 | ) 2658 | 2659 | result = await fetch_apo( 2660 | symbol, 2661 | interval, 2662 | month, 2663 | series_type, 2664 | fastperiod, 2665 | slowperiod, 2666 | matype, 2667 | datatype, 2668 | ) 2669 | 2670 | case AlphavantageTools.PPO.value: 2671 | symbol = arguments.get("symbol") 2672 | interval = arguments.get("interval") 2673 | month = arguments.get("month") 2674 | series_type = arguments.get("series_type") 2675 | fastperiod = arguments.get("fastperiod", 12) 2676 | slowperiod = arguments.get("slowperiod", 26) 2677 | matype = arguments.get("matype", 0) 2678 | datatype = arguments.get("datatype", "json") 2679 | 2680 | if not symbol or not interval or not series_type: 2681 | raise ValueError( 2682 | "Missing required arguments: symbol, interval, series_type" 2683 | ) 2684 | 2685 | result = await fetch_ppo( 2686 | symbol, 2687 | interval, 2688 | month, 2689 | series_type, 2690 | fastperiod, 2691 | slowperiod, 2692 | matype, 2693 | datatype, 2694 | ) 2695 | 2696 | case AlphavantageTools.MOM.value: 2697 | symbol = arguments.get("symbol") 2698 | interval = arguments.get("interval") 2699 | month = arguments.get("month") 2700 | time_period = arguments.get("time_period", 10) 2701 | series_type = arguments.get("series_type") 2702 | datatype = arguments.get("datatype", "json") 2703 | 2704 | if not symbol or not interval or not series_type: 2705 | raise ValueError( 2706 | "Missing required arguments: symbol, interval, series_type" 2707 | ) 2708 | 2709 | result = await fetch_mom( 2710 | symbol, interval, month, time_period, series_type, datatype 2711 | ) 2712 | 2713 | case AlphavantageTools.BOP.value: 2714 | symbol = arguments.get("symbol") 2715 | interval = arguments.get("interval") 2716 | month = arguments.get("month") 2717 | datatype = arguments.get("datatype", "json") 2718 | 2719 | if not symbol or not interval: 2720 | raise ValueError("Missing required arguments: symbol, interval") 2721 | 2722 | result = await fetch_bop(symbol, interval, month, datatype) 2723 | 2724 | case AlphavantageTools.CCI.value: 2725 | symbol = arguments.get("symbol") 2726 | interval = arguments.get("interval") 2727 | month = arguments.get("month") 2728 | time_period = arguments.get("time_period", 20) 2729 | datatype = arguments.get("datatype", "json") 2730 | 2731 | if not symbol or not interval: 2732 | raise ValueError("Missing required arguments: symbol, interval") 2733 | 2734 | result = await fetch_cci(symbol, interval, month, time_period, datatype) 2735 | 2736 | case AlphavantageTools.CMO.value: 2737 | symbol = arguments.get("symbol") 2738 | interval = arguments.get("interval") 2739 | month = arguments.get("month") 2740 | time_period = arguments.get("time_period", 14) 2741 | datatype = arguments.get("datatype", "json") 2742 | 2743 | if not symbol or not interval: 2744 | raise ValueError("Missing required arguments: symbol, interval") 2745 | 2746 | result = await fetch_cmo(symbol, interval, month, time_period, datatype) 2747 | 2748 | case AlphavantageTools.ROC.value: 2749 | symbol = arguments.get("symbol") 2750 | interval = arguments.get("interval") 2751 | month = arguments.get("month") 2752 | time_period = arguments.get("time_period", 10) 2753 | series_type = arguments.get("series_type") 2754 | datatype = arguments.get("datatype", "json") 2755 | 2756 | if not symbol or not interval or not series_type: 2757 | raise ValueError( 2758 | "Missing required arguments: symbol, interval, series_type" 2759 | ) 2760 | 2761 | result = await fetch_roc( 2762 | symbol, interval, month, time_period, series_type, datatype 2763 | ) 2764 | 2765 | case AlphavantageTools.ROCR.value: 2766 | symbol = arguments.get("symbol") 2767 | interval = arguments.get("interval") 2768 | month = arguments.get("month") 2769 | time_period = arguments.get("time_period", 10) 2770 | series_type = arguments.get("series_type") 2771 | datatype = arguments.get("datatype", "json") 2772 | 2773 | if not symbol or not interval or not series_type: 2774 | raise ValueError( 2775 | "Missing required arguments: symbol, interval, series_type" 2776 | ) 2777 | 2778 | result = await fetch_rocr( 2779 | symbol, interval, month, time_period, series_type, datatype 2780 | ) 2781 | 2782 | case AlphavantageTools.AROON.value: 2783 | symbol = arguments.get("symbol") 2784 | interval = arguments.get("interval") 2785 | month = arguments.get("month") 2786 | time_period = arguments.get("time_period", 14) 2787 | datatype = arguments.get("datatype", "json") 2788 | 2789 | if not symbol or not interval: 2790 | raise ValueError("Missing required arguments: symbol, interval") 2791 | 2792 | result = await fetch_aroon( 2793 | symbol, interval, month, time_period, datatype 2794 | ) 2795 | 2796 | case AlphavantageTools.AROONOSC.value: 2797 | symbol = arguments.get("symbol") 2798 | interval = arguments.get("interval") 2799 | month = arguments.get("month") 2800 | time_period = arguments.get("time_period", 14) 2801 | datatype = arguments.get("datatype", "json") 2802 | 2803 | if not symbol or not interval: 2804 | raise ValueError("Missing required arguments: symbol, interval") 2805 | 2806 | result = await fetch_aroonosc( 2807 | symbol, interval, month, time_period, datatype 2808 | ) 2809 | 2810 | case AlphavantageTools.MFI.value: 2811 | symbol = arguments.get("symbol") 2812 | interval = arguments.get("interval") 2813 | month = arguments.get("month") 2814 | time_period = arguments.get("time_period", 14) 2815 | datatype = arguments.get("datatype", "json") 2816 | 2817 | if not symbol or not interval: 2818 | raise ValueError("Missing required arguments: symbol, interval") 2819 | 2820 | result = await fetch_mfi(symbol, interval, month, time_period, datatype) 2821 | 2822 | case AlphavantageTools.TRIX.value: 2823 | symbol = arguments.get("symbol") 2824 | interval = arguments.get("interval") 2825 | month = arguments.get("month") 2826 | time_period = arguments.get("time_period", 30) 2827 | series_type = arguments.get("series_type") 2828 | datatype = arguments.get("datatype", "json") 2829 | 2830 | if not symbol or not interval or not series_type: 2831 | raise ValueError( 2832 | "Missing required arguments: symbol, interval, series_type" 2833 | ) 2834 | 2835 | result = await fetch_trix( 2836 | symbol, interval, month, time_period, series_type, datatype 2837 | ) 2838 | 2839 | case AlphavantageTools.ULTOSC.value: 2840 | symbol = arguments.get("symbol") 2841 | interval = arguments.get("interval") 2842 | month = arguments.get("month") 2843 | time_period1 = arguments.get("time_period1", 7) 2844 | time_period2 = arguments.get("time_period2", 14) 2845 | time_period3 = arguments.get("time_period3", 28) 2846 | datatype = arguments.get("datatype", "json") 2847 | 2848 | if not symbol or not interval: 2849 | raise ValueError("Missing required arguments: symbol, interval") 2850 | 2851 | result = await fetch_ultosc( 2852 | symbol, 2853 | interval, 2854 | month, 2855 | time_period1, 2856 | time_period2, 2857 | time_period3, 2858 | datatype, 2859 | ) 2860 | 2861 | case AlphavantageTools.DX.value: 2862 | symbol = arguments.get("symbol") 2863 | interval = arguments.get("interval") 2864 | month = arguments.get("month") 2865 | time_period = arguments.get("time_period", 14) 2866 | datatype = arguments.get("datatype", "json") 2867 | 2868 | if not symbol or not interval or not time_period: 2869 | raise ValueError( 2870 | "Missing required arguments: symbol, interval, time_period" 2871 | ) 2872 | 2873 | result = await fetch_dx(symbol, interval, month, time_period, datatype) 2874 | 2875 | case AlphavantageTools.MINUS_DI.value: 2876 | symbol = arguments.get("symbol") 2877 | interval = arguments.get("interval") 2878 | month = arguments.get("month") 2879 | time_period = arguments.get("time_period", 14) 2880 | datatype = arguments.get("datatype", "json") 2881 | 2882 | if not symbol or not interval or not time_period: 2883 | raise ValueError( 2884 | "Missing required arguments: symbol, interval, time_period" 2885 | ) 2886 | 2887 | result = await fetch_minus_di( 2888 | symbol, interval, month, time_period, datatype 2889 | ) 2890 | 2891 | case AlphavantageTools.PLUS_DI.value: 2892 | symbol = arguments.get("symbol") 2893 | interval = arguments.get("interval") 2894 | month = arguments.get("month") 2895 | time_period = arguments.get("time_period", 14) 2896 | datatype = arguments.get("datatype", "json") 2897 | 2898 | if not symbol or not interval or not time_period: 2899 | raise ValueError( 2900 | "Missing required arguments: symbol, interval, time_period" 2901 | ) 2902 | 2903 | result = await fetch_plus_di( 2904 | symbol, interval, month, time_period, datatype 2905 | ) 2906 | case AlphavantageTools.MINUS_DM.value: 2907 | symbol = arguments.get("symbol") 2908 | interval = arguments.get("interval") 2909 | month = arguments.get("month") 2910 | time_period = arguments.get("time_period", 14) 2911 | datatype = arguments.get("datatype", "json") 2912 | 2913 | if not symbol or not interval or not time_period: 2914 | raise ValueError( 2915 | "Missing required arguments: symbol, interval, time_period" 2916 | ) 2917 | 2918 | result = await fetch_minus_dm( 2919 | symbol, interval, month, time_period, datatype 2920 | ) 2921 | 2922 | case AlphavantageTools.PLUS_DM.value: 2923 | symbol = arguments.get("symbol") 2924 | interval = arguments.get("interval") 2925 | month = arguments.get("month") 2926 | time_period = arguments.get("time_period", 14) 2927 | datatype = arguments.get("datatype", "json") 2928 | 2929 | if not symbol or not interval or not time_period: 2930 | raise ValueError( 2931 | "Missing required arguments: symbol, interval, time_period" 2932 | ) 2933 | 2934 | result = await fetch_plus_dm( 2935 | symbol, interval, month, time_period, datatype 2936 | ) 2937 | 2938 | case AlphavantageTools.BBANDS.value: 2939 | symbol = arguments.get("symbol") 2940 | interval = arguments.get("interval") 2941 | month = arguments.get("month") 2942 | time_period = arguments.get("time_period", 20) 2943 | series_type = arguments.get("series_type") 2944 | nbdevup = arguments.get("nbdevup", 2) 2945 | nbdevdn = arguments.get("nbdevdn", 2) 2946 | matype = arguments.get("matype", 0) 2947 | datatype = arguments.get("datatype", "json") 2948 | 2949 | if not symbol or not interval or not series_type: 2950 | raise ValueError( 2951 | "Missing required arguments: symbol, interval, series_type" 2952 | ) 2953 | 2954 | result = await fetch_bbands( 2955 | symbol, 2956 | interval, 2957 | month, 2958 | time_period, 2959 | series_type, 2960 | nbdevup, 2961 | nbdevdn, 2962 | matype, 2963 | datatype, 2964 | ) 2965 | 2966 | case AlphavantageTools.MIDPOINT.value: 2967 | symbol = arguments.get("symbol") 2968 | interval = arguments.get("interval") 2969 | month = arguments.get("month") 2970 | time_period = arguments.get("time_period", 14) 2971 | series_type = arguments.get("series_type") 2972 | datatype = arguments.get("datatype", "json") 2973 | 2974 | if not symbol or not interval or not time_period or not series_type: 2975 | raise ValueError( 2976 | "Missing required arguments: symbol, interval, time_period, series_type" 2977 | ) 2978 | 2979 | result = await fetch_midpoint( 2980 | symbol, interval, month, time_period, series_type, datatype 2981 | ) 2982 | 2983 | case AlphavantageTools.MIDPRICE.value: 2984 | symbol = arguments.get("symbol") 2985 | interval = arguments.get("interval") 2986 | month = arguments.get("month") 2987 | time_period = arguments.get("time_period", 14) 2988 | datatype = arguments.get("datatype", "json") 2989 | 2990 | if not symbol or not interval or not time_period: 2991 | raise ValueError( 2992 | "Missing required arguments: symbol, interval, time_period" 2993 | ) 2994 | 2995 | result = await fetch_midprice( 2996 | symbol, interval, month, time_period, datatype 2997 | ) 2998 | 2999 | case AlphavantageTools.SAR.value: 3000 | symbol = arguments.get("symbol") 3001 | interval = arguments.get("interval") 3002 | month = arguments.get("month") 3003 | acceleration = arguments.get("acceleration", 0.02) 3004 | maximum = arguments.get("maximum", 0.2) 3005 | datatype = arguments.get("datatype", "json") 3006 | 3007 | if not symbol or not interval: 3008 | raise ValueError("Missing required arguments: symbol, interval") 3009 | 3010 | result = await fetch_sar( 3011 | symbol, interval, month, acceleration, maximum, datatype 3012 | ) 3013 | 3014 | case AlphavantageTools.TRANGE.value: 3015 | symbol = arguments.get("symbol") 3016 | interval = arguments.get("interval") 3017 | month = arguments.get("month") 3018 | datatype = arguments.get("datatype", "json") 3019 | 3020 | if not symbol or not interval: 3021 | raise ValueError("Missing required arguments: symbol, interval") 3022 | 3023 | result = await fetch_trange(symbol, interval, month, datatype) 3024 | 3025 | case AlphavantageTools.ATR.value: 3026 | symbol = arguments.get("symbol") 3027 | interval = arguments.get("interval") 3028 | month = arguments.get("month") 3029 | time_period = arguments.get("time_period", 14) 3030 | datatype = arguments.get("datatype", "json") 3031 | 3032 | if not symbol or not interval or not time_period: 3033 | raise ValueError( 3034 | "Missing required arguments: symbol, interval, time_period" 3035 | ) 3036 | 3037 | result = await fetch_atr(symbol, interval, month, time_period, datatype) 3038 | 3039 | case AlphavantageTools.NATR.value: 3040 | symbol = arguments.get("symbol") 3041 | interval = arguments.get("interval") 3042 | month = arguments.get("month") 3043 | time_period = arguments.get("time_period", 14) 3044 | datatype = arguments.get("datatype", "json") 3045 | 3046 | if not symbol or not interval or not time_period: 3047 | raise ValueError( 3048 | "Missing required arguments: symbol, interval, time_period" 3049 | ) 3050 | 3051 | result = await fetch_natr( 3052 | symbol, interval, month, time_period, datatype 3053 | ) 3054 | 3055 | case AlphavantageTools.AD.value: 3056 | symbol = arguments.get("symbol") 3057 | interval = arguments.get("interval") 3058 | month = arguments.get("month") 3059 | datatype = arguments.get("datatype", "json") 3060 | 3061 | if not symbol or not interval: 3062 | raise ValueError("Missing required arguments: symbol, interval") 3063 | 3064 | result = await fetch_ad(symbol, interval, month, datatype) 3065 | 3066 | case AlphavantageTools.ADOSC.value: 3067 | symbol = arguments.get("symbol") 3068 | interval = arguments.get("interval") 3069 | month = arguments.get("month") 3070 | fastperiod = arguments.get("fastperiod", 3) 3071 | slowperiod = arguments.get("slowperiod", 10) 3072 | datatype = arguments.get("datatype", "json") 3073 | 3074 | if not symbol or not interval: 3075 | raise ValueError("Missing required arguments: symbol, interval") 3076 | 3077 | result = await fetch_adosc( 3078 | symbol, interval, month, fastperiod, slowperiod, datatype 3079 | ) 3080 | 3081 | case AlphavantageTools.OBV.value: 3082 | symbol = arguments.get("symbol") 3083 | interval = arguments.get("interval") 3084 | month = arguments.get("month") 3085 | datatype = arguments.get("datatype", "json") 3086 | 3087 | if not symbol or not interval: 3088 | raise ValueError("Missing required arguments: symbol, interval") 3089 | 3090 | result = await fetch_obv(symbol, interval, month, datatype) 3091 | 3092 | case AlphavantageTools.HT_TRENDLINE.value: 3093 | symbol = arguments.get("symbol") 3094 | interval = arguments.get("interval") 3095 | month = arguments.get("month") 3096 | series_type = arguments.get("series_type") 3097 | datatype = arguments.get("datatype", "json") 3098 | 3099 | if not symbol or not interval or not series_type: 3100 | raise ValueError( 3101 | "Missing required arguments: symbol, interval, series_type" 3102 | ) 3103 | 3104 | result = await fetch_ht_trendline( 3105 | symbol, interval, month, series_type, datatype 3106 | ) 3107 | 3108 | case AlphavantageTools.HT_SINE.value: 3109 | symbol = arguments.get("symbol") 3110 | interval = arguments.get("interval") 3111 | month = arguments.get("month") 3112 | series_type = arguments.get("series_type") 3113 | datatype = arguments.get("datatype", "json") 3114 | 3115 | if not symbol or not interval or not series_type: 3116 | raise ValueError( 3117 | "Missing required arguments: symbol, interval, series_type" 3118 | ) 3119 | 3120 | result = await fetch_ht_sine( 3121 | symbol, interval, month, series_type, datatype 3122 | ) 3123 | 3124 | case AlphavantageTools.HT_TRENDMODE.value: 3125 | symbol = arguments.get("symbol") 3126 | interval = arguments.get("interval") 3127 | month = arguments.get("month") 3128 | datatype = arguments.get("datatype", "json") 3129 | 3130 | if not symbol or not interval: 3131 | raise ValueError("Missing required arguments: symbol, interval") 3132 | 3133 | result = await fetch_ht_trendmode(symbol, interval, month, datatype) 3134 | 3135 | case AlphavantageTools.HT_DCPERIOD.value: 3136 | symbol = arguments.get("symbol") 3137 | interval = arguments.get("interval") 3138 | month = arguments.get("month") 3139 | series_types = arguments.get("series_types") 3140 | datatype = arguments.get("datatype", "json") 3141 | 3142 | if not symbol or not interval or not series_types: 3143 | raise ValueError( 3144 | "Missing required arguments: symbol, interval, series_types" 3145 | ) 3146 | 3147 | result = await fetch_ht_dcperiod( 3148 | symbol, interval, month, series_types, datatype 3149 | ) 3150 | 3151 | case AlphavantageTools.HT_DCPHASE.value: 3152 | symbol = arguments.get("symbol") 3153 | interval = arguments.get("interval") 3154 | month = arguments.get("month") 3155 | series_types = arguments.get("series_types") 3156 | datatype = arguments.get("datatype", "json") 3157 | 3158 | if not symbol or not interval or not series_types: 3159 | raise ValueError( 3160 | "Missing required arguments: symbol, interval, series_types" 3161 | ) 3162 | 3163 | result = await fetch_ht_dcphase( 3164 | symbol, interval, month, series_types, datatype 3165 | ) 3166 | 3167 | case AlphavantageTools.HT_PHASOR.value: 3168 | symbol = arguments.get("symbol") 3169 | interval = arguments.get("interval") 3170 | month = arguments.get("month") 3171 | series_types = arguments.get("series_types") 3172 | datatype = arguments.get("datatype", "json") 3173 | 3174 | if not symbol or not interval or not series_types: 3175 | raise ValueError( 3176 | "Missing required arguments: symbol, interval, series_types" 3177 | ) 3178 | 3179 | result = await fetch_ht_phasor( 3180 | symbol, interval, month, series_types, datatype 3181 | ) 3182 | case _: 3183 | raise ValueError(f"Unknown tool: {name}") 3184 | 3185 | return [types.TextContent(type="text", text=json.dumps(result, indent=2))] 3186 | 3187 | except Exception as e: 3188 | raise ValueError(f"Error processing alphavantage query: {str(e)}") from e 3189 | 3190 | 3191 | async def main(): 3192 | # Run the server using stdin/stdout streams 3193 | async with mcp.server.stdio.stdio_server() as (read_stream, write_stream): 3194 | await server.run( 3195 | read_stream, 3196 | write_stream, 3197 | InitializationOptions( 3198 | server_name="alphavantage", 3199 | server_version="0.1.0", 3200 | capabilities=server.get_capabilities( 3201 | notification_options=NotificationOptions(), 3202 | experimental_capabilities={}, 3203 | ), 3204 | ), 3205 | ) 3206 | 3207 | def run_main(): 3208 | import asyncio 3209 | asyncio.run(main()) 3210 | 3211 | if __name__ == "__main__": 3212 | run_main() ```