MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / get_message

Function get_message

crates/opencode-server/src/routes.rs:1862–1884  ·  view source on GitHub ↗
(
    State(state): State<Arc<ServerState>>,
    Path((session_id, msg_id)): Path<(String, String)>,
)

Source from the content-addressed store, hash-verified

1860}
1861
1862async fn get_message(
1863 State(state): State<Arc<ServerState>>,
1864 Path((session_id, msg_id)): Path<(String, String)>,
1865) -> Result<Json<serde_json::Value>> {
1866 let sessions = state.sessions.lock().await;
1867 let session = sessions
1868 .get(&session_id)
1869 .ok_or_else(|| ApiError::SessionNotFound(session_id.clone()))?;
1870 let message = session
1871 .get_message(&msg_id)
1872 .ok_or_else(|| ApiError::NotFound(format!("Message not found: {}", msg_id)))?;
1873
1874 let info = serde_json::json!({
1875 "id": message.id,
1876 "sessionID": session_id,
1877 "role": message_role_name(&message.role),
1878 "createdAt": message.created_at.timestamp_millis(),
1879 });
1880 Ok(Json(serde_json::json!({
1881 "info": info,
1882 "parts": message.parts.clone(),
1883 })))
1884}
1885
1886#[derive(Debug, Deserialize)]
1887pub struct UpdatePartRequest {

Callers

nothing calls this directly

Calls 3

get_messageMethod · 0.80
getMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected