MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / serialize_response_line

Function serialize_response_line

src/mcp/server.rs:657–676  ·  view source on GitHub ↗
(resp: &JsonRpcResponse)

Source from the content-addressed store, hash-verified

655}
656
657fn serialize_response_line(resp: &JsonRpcResponse) -> String {
658 match serde_json::to_string(resp) {
659 Ok(line) => line,
660 Err(e) => {
661 eprintln!("failed to serialize response: {e}");
662 let fallback = JsonRpcResponse::error_with_data(
663 resp.id.clone(),
664 ErrorCode::InternalError,
665 "failed to serialize JSON-RPC response".to_string(),
666 Some(json!({
667 "reason_code": "response_serialization_failed",
668 "detail": e.to_string(),
669 })),
670 );
671 serde_json::to_string(&fallback).unwrap_or_else(|fallback_err| {
672 hardcoded_internal_error_response(&resp.id, &fallback_err.to_string())
673 })
674 }
675 }
676}
677
678/// Cached result of a latest-version check against GitHub releases.
679struct VersionCheckState {

Callers 2

handle_and_writeMethod · 0.85

Calls 1

Tested by

no test coverage detected