diff --git a/crates/idx-mcp/src/params.rs b/crates/idx-mcp/src/params.rs index 5e3c4a1..88ee860 100644 --- a/crates/idx-mcp/src/params.rs +++ b/crates/idx-mcp/src/params.rs @@ -1,6 +1,7 @@ //! Tool inputs. String enums are validated by idx-core's `FromStr`, so the //! accepted values and error messages match the CLI; the schemas list them. +use idx_core::analysis::bandar::TIERS; use idx_core::api::types::{Interval, Period}; use idx_core::broker::types::{BrokerBoard, BrokerInvestor}; use idx_core::flow::types::FlowSource; @@ -155,6 +156,7 @@ pub struct BandarParams { pub scope: BrokerScope, /// Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5). #[serde(default)] + #[schemars(schema_with = "top_schema")] pub top: Option, } @@ -255,3 +257,7 @@ fn board_schema(_: &mut SchemaGenerator) -> Schema { fn flow_source_schema(_: &mut SchemaGenerator) -> Schema { string_enum(FlowSource::ALL.map(FlowSource::as_str).to_vec()) } + +fn top_schema(_: &mut SchemaGenerator) -> Schema { + json_schema!({ "type": "integer", "enum": TIERS }) +} diff --git a/crates/idx-mcp/tests/golden/tools.json b/crates/idx-mcp/tests/golden/tools.json index 25cb886..ad343a7 100644 --- a/crates/idx-mcp/tests/golden/tools.json +++ b/crates/idx-mcp/tests/golden/tools.json @@ -59,13 +59,13 @@ "top": { "default": null, "description": "Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5).", - "format": "uint8", - "maximum": 255, - "minimum": 0, - "type": [ - "integer", - "null" - ] + "enum": [ + 1, + 3, + 5, + 10 + ], + "type": "integer" } }, "required": [ diff --git a/web/src/content/docs/mcp/tools.md b/web/src/content/docs/mcp/tools.md index 7287341..0380cc9 100644 --- a/web/src/content/docs/mcp/tools.md +++ b/web/src/content/docs/mcp/tools.md @@ -22,7 +22,7 @@ Bandarmology for one or more IDX tickers from the broker summary: for the top 1, | `investor` | `all` / `foreign` / `domestic` | no | Whose trades to count, by investor domicile (default "all"). | | `symbols` | array of string | yes | IDX tickers, e.g. ["BBCA", "BBRI"]; the `.JK` suffix is optional. At most 20. | | `to` | string | no | Last session of the range, YYYY-MM-DD (default today). | -| `top` | integer | no | Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5). | +| `top` | `1` / `3` / `5` / `10` | no | Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5). | ## `analyze_stock`