mcp: small changes

This commit is contained in:
nym21
2025-06-25 10:44:24 +02:00
parent 50bfdb0d68
commit c4167ddaad
5 changed files with 69 additions and 42 deletions
+24
View File
@@ -12,29 +12,53 @@ use serde::{Deserialize, de::Error};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, JsonSchema)]
pub enum Index {
#[schemars(description = "Date/day index")]
DateIndex,
#[schemars(description = "Decade index")]
DecadeIndex,
#[schemars(description = "Difficulty epoch index (equivalent to ~2 weeks)")]
DifficultyEpoch,
#[schemars(description = "Empty output index")]
EmptyOutputIndex,
#[schemars(description = "Halving epoch index (equivalent to ~4 years)")]
HalvingEpoch,
#[schemars(description = "Height/block index")]
Height,
#[schemars(description = "Transaction input index (based on total)")]
InputIndex,
#[schemars(description = "Month index")]
MonthIndex,
#[schemars(description = "Op return index")]
OpReturnIndex,
#[schemars(description = "Transaction output index (based on total)")]
OutputIndex,
#[schemars(description = "Index of P2A address")]
P2AAddressIndex,
#[schemars(description = "Index of P2MS output")]
P2MSOutputIndex,
#[schemars(description = "Index of P2PK (33 bytes) address")]
P2PK33AddressIndex,
#[schemars(description = "Index of P2PK (65 bytes) address")]
P2PK65AddressIndex,
#[schemars(description = "Index of P2PKH address")]
P2PKHAddressIndex,
#[schemars(description = "Index of P2SH address")]
P2SHAddressIndex,
#[schemars(description = "Index of P2TR address")]
P2TRAddressIndex,
#[schemars(description = "Index of P2WPKH address")]
P2WPKHAddressIndex,
#[schemars(description = "Index of P2WSH address")]
P2WSHAddressIndex,
#[schemars(description = "Quarter index")]
QuarterIndex,
#[schemars(description = "Transaction index")]
TxIndex,
#[schemars(description = "Unknown output index")]
UnknownOutputIndex,
#[schemars(description = "Week index")]
WeekIndex,
#[schemars(description = "Year index")]
YearIndex,
}
+10 -4
View File
@@ -12,11 +12,11 @@ use crate::{
#[derive(Debug, Deserialize, JsonSchema)]
pub struct Params {
#[serde(alias = "i")]
#[schemars(description = "Index of the values requested")]
#[schemars(description = "Index of requested vecs")]
pub index: Index,
#[serde(alias = "v")]
#[schemars(description = "Ids of the requested vecs")]
#[schemars(description = "Ids of requested vecs")]
pub ids: MaybeIds,
#[serde(flatten)]
@@ -45,18 +45,24 @@ impl From<((Index, String), ParamsOpt)> for Params {
pub struct ParamsOpt {
#[serde(default, alias = "f", deserialize_with = "de_unquote_i64")]
/// Inclusive starting index, if negative will be from the end
#[schemars(description = "Inclusive starting index, if negative will be from the end")]
from: Option<i64>,
#[serde(default, alias = "t", deserialize_with = "de_unquote_i64")]
/// Exclusive ending index, if negative will be from the end, overrides 'count'
#[schemars(
description = "Exclusive ending index, if negative will be from the end, overrides 'count'"
)]
to: Option<i64>,
#[serde(default, alias = "c", deserialize_with = "de_unquote_usize")]
/// Number of values
/// Number of values requested
#[schemars(description = "Number of values requested")]
count: Option<usize>,
/// Format of the output
#[serde(default)]
/// Format of the output
#[schemars(description = "Format of the output")]
format: Option<Format>,
}