fix(mcp): analyze_bandar lists the tiers top accepts

The schema said uint8 0-255; only 1, 3, 5 and 10 are valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V3syn2fN2LNo5pvTSqc6eh
This commit is contained in:
hermes 2026-10-18 11:48:00 +00:00
commit 6f211a398f
3 changed files with 14 additions and 8 deletions

View file

@ -1,6 +1,7 @@
//! Tool inputs. String enums are validated by idx-core's `FromStr`, so the //! 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. //! 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::api::types::{Interval, Period};
use idx_core::broker::types::{BrokerBoard, BrokerInvestor}; use idx_core::broker::types::{BrokerBoard, BrokerInvestor};
use idx_core::flow::types::FlowSource; use idx_core::flow::types::FlowSource;
@ -155,6 +156,7 @@ pub struct BandarParams {
pub scope: BrokerScope, pub scope: BrokerScope,
/// Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5). /// Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5).
#[serde(default)] #[serde(default)]
#[schemars(schema_with = "top_schema")]
pub top: Option<u8>, pub top: Option<u8>,
} }
@ -255,3 +257,7 @@ fn board_schema(_: &mut SchemaGenerator) -> Schema {
fn flow_source_schema(_: &mut SchemaGenerator) -> Schema { fn flow_source_schema(_: &mut SchemaGenerator) -> Schema {
string_enum(FlowSource::ALL.map(FlowSource::as_str).to_vec()) string_enum(FlowSource::ALL.map(FlowSource::as_str).to_vec())
} }
fn top_schema(_: &mut SchemaGenerator) -> Schema {
json_schema!({ "type": "integer", "enum": TIERS })
}

View file

@ -59,13 +59,13 @@
"top": { "top": {
"default": null, "default": null,
"description": "Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5).", "description": "Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5).",
"format": "uint8", "enum": [
"maximum": 255, 1,
"minimum": 0, 3,
"type": [ 5,
"integer", 10
"null" ],
] "type": "integer"
} }
}, },
"required": [ "required": [

View file

@ -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"). | | `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. | | `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). | | `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` ## `analyze_stock`