pub struct Response {
pub id: String,
pub success: bool,
pub data: Value,
}Expand description
Outbound response envelope.
data is flattened into the top-level JSON object, so a response like
Response { id: "1", success: true, data: json!({"command": "pong"}) }
serializes to {"id":"1","success":true,"command":"pong"}.
§Honest reporting convention (tri-state)
Tools that search, check, or otherwise produce results MUST follow this convention so agents can distinguish “did the work, found nothing” from “couldn’t do the work” from “partially did the work”:
-
success: false— the requested work could not be performed. Includes acode(e.g.,"path_not_found","no_lsp_server","project_too_large") and a human-readablemessage. The agent should treat this as an error and read the message. -
success: true+ completion signaling — the work was performed. Tools must report whether the result is complete OR which subset was actually performed. Conventional fields:complete: true— full result, agent can trust absence of itemscomplete: false+pending_files: [...]/unchecked_files: [...]/scope_warnings: [...]— partial result, with named gapsremoved: true|false(for mutations) — did the file actually changeskipped_files: [{file, reason}]— files we couldn’t process inside the requested scopeno_files_matched_scope: bool— the scope (path/glob) found zero candidates (distinct from “candidates found, no matches”)
-
Side-effect skip codes — when the main work succeeded but a non-essential side step was skipped (e.g., post-write formatting), use a
<step>_skipped_reasonfield. Approved values:format_skipped_reason:"unsupported_language"|"no_formatter_configured"|"formatter_not_installed"|"timeout"|"error"validate_skipped_reason:"unsupported_language"|"no_checker_configured"|"checker_not_installed"|"timeout"|"error"
Anti-patterns to avoid:
- Returning
success: truewith empty results when the scope didn’t resolve to any files — agent reads as “all clear” but really nothing was checked. Useno_files_matched_scope: trueorsuccess: false, code: "path_not_found". - Reusing
format_skipped_reason: "not_found"for two different causes (“no formatter configured” vs “configured formatter binary missing”). The agent can’t act on the ambiguous code.
See ARCHITECTURE.md “Honest reporting convention” for the full rationale.
Fields§
§id: String§success: bool§data: ValueImplementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl UnwindSafe for Response
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> 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