pub struct RecallRequest {Show 18 fields
pub context: String,
pub namespace: Option<String>,
pub limit: Option<i64>,
pub tags: Option<String>,
pub since: Option<String>,
pub until: Option<String>,
pub as_agent: Option<String>,
pub budget_tokens: Option<i64>,
pub context_tokens: Option<Vec<String>>,
pub session_default: Option<bool>,
pub session_id: Option<String>,
pub include_archived: Option<bool>,
pub has_citations: Option<bool>,
pub source_uri_prefix: Option<String>,
pub kinds: Option<KindsFilter>,
pub confidence_tier: Option<String>,
pub verbose_provenance: Option<bool>,
pub format: Option<String>,
}Expand description
v0.7.0 #972 D1.3 (#984) / #967 — canonical recall-request DTO.
Marshalled once per surface (HTTP / MCP / CLI), then handed to the
downstream recall pipeline. Adding a new field (Form 6 kinds,
Form 4 has_citations, confidence_tier, etc.) lands in one place
instead of four positional-arg lists.
Schemars contract. Every doc-comment description and field
attribute is byte-equal to the legacy hand-coded entry in
crate::mcp::registry::tool_definitions — see the
d1_3_984_tests::recall_parity_984 parity test which asserts the
derived schema matches byte-for-byte.
Fields§
§context: StringWhat to recall
namespace: Option<String>Namespace filter
limit: Option<i64>Tag filter
since: Option<String>RFC3339 lower bound on created_at
until: Option<String>RFC3339 upper bound on created_at
as_agent: Option<String>§budget_tokens: Option<i64>P6/R1 cl100k content cap. 0=empty; top kept (meta.budget_overflow=true).
context_tokens: Option<Vec<String>>Recent conversation tokens; biases query embedding 70/30 (v0.6.0.0).
session_default: Option<bool>Splice [agents.defaults.recall_scope]. explicit > scope > defaults.
session_id: Option<String>§include_archived: Option<bool>WT-1-E: include atomised sources alongside atoms.
has_citations: Option<bool>Form 4 (#757): require non-empty citations array.
source_uri_prefix: Option<String>Form 4 (#757): restrict by source_uri prefix (e.g. ‘doc:’, ‘uri:https://’).
kinds: Option<KindsFilter>Form 6 (#759) kind filter. Array/CSV. OR within; AND across.
confidence_tier: Option<String>Gap 4 (#887) tier filter.
verbose_provenance: Option<bool>Gap 7 (#890): per-row provenance decoration.
format: Option<String>Response format. toon_compact saves 79% vs json.
Implementations§
Source§impl RecallRequest
impl RecallRequest
Sourcepub fn from_mcp_params(params: &Value) -> Result<Self, String>
pub fn from_mcp_params(params: &Value) -> Result<Self, String>
MCP surface: marshal a params JSON bag (the arguments field
of a tools/call request) into a typed RecallRequest.
Returns Err when context is missing — every other field is
optional and defaults via #[serde(default)]. The legacy
handle_recall body used params["context"].as_str().ok_or(...)
to enforce the same invariant; this constructor preserves the
exact error string for callers that match on it.
On a deserialise failure (e.g. caller passes limit: "ten"),
returns the serde error rendered as a string so the MCP
dispatcher can return the corresponding -32602 Invalid params.
§Errors
Returns Err when:
contextis missing or not a string (“context is required”)- a typed field receives the wrong JSON shape
Saturation semantics. Pre-#967 the legacy code used
params["limit"].as_u64() + usize::try_from(v).unwrap_or(usize::MAX),
which silently saturated u64::MAX rather than erroring. The
DTO’s limit: Option<i64> would refuse to deserialize a value
beyond i64::MAX, so the constructor clamps limit (and
budget_tokens) values that exceed the signed range to
i64::MAX BEFORE handing the bag to serde. This preserves the
limit_overflow_saturates regression test contract.
Sourcepub fn from_http_query(q: &RecallQuery) -> Self
pub fn from_http_query(q: &RecallQuery) -> Self
HTTP GET surface: marshal a crate::models::RecallQuery into
the canonical DTO. context resolution honours the
context > query > q precedence the HTTP handler enforces;
callers must reject the empty result before recall.
Sourcepub fn from_http_body(body: &RecallBody) -> Self
pub fn from_http_body(body: &RecallBody) -> Self
HTTP POST surface: marshal a crate::models::RecallBody into
the canonical DTO. context resolution honours the
context > query > q precedence the HTTP handler enforces.
Sourcepub fn from_cli_args(args: &RecallArgs) -> Self
pub fn from_cli_args(args: &RecallArgs) -> Self
CLI surface: marshal a crate::cli::recall::RecallArgs (clap-
derived) into the canonical DTO.
Sourcepub fn resolved_limit(&self) -> usize
pub fn resolved_limit(&self) -> usize
Resolved limit clamped to usize. The recall pipeline caps the
returned set at min(50) downstream; this constructor just
converts the wire Option<i64> into a usable size with a
default of 10 when the caller omitted the field.
Sourcepub fn resolved_budget_tokens(&self) -> Option<usize>
pub fn resolved_budget_tokens(&self) -> Option<usize>
Resolved budget-tokens limit clamped to usize. None when the
caller did not request a budget cap; Some(0) is preserved per
the P6/R1 semantics (zero is a legitimate “return nothing”
request distinct from “no budget set”).
Trait Implementations§
Source§impl Clone for RecallRequest
impl Clone for RecallRequest
Source§fn clone(&self) -> RecallRequest
fn clone(&self) -> RecallRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RecallRequest
impl Debug for RecallRequest
Source§impl Default for RecallRequest
impl Default for RecallRequest
Source§fn default() -> RecallRequest
fn default() -> RecallRequest
Source§impl<'de> Deserialize<'de> for RecallRequest
impl<'de> Deserialize<'de> for RecallRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RecallRequest
impl JsonSchema for RecallRequest
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for RecallRequest
impl RefUnwindSafe for RecallRequest
impl Send for RecallRequest
impl Sync for RecallRequest
impl Unpin for RecallRequest
impl UnsafeUnpin for RecallRequest
impl UnwindSafe for RecallRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more