Tool reply meta (#6074)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2025-12-11 19:43:36 -05:00
committed by GitHub
parent 7dd244eff6
commit cdab2fc3a6
52 changed files with 1852 additions and 1083 deletions
+15 -6
View File
@@ -355,8 +355,9 @@ fn format_message_for_compacting(msg: &Message) -> String {
}
}
MessageContent::ToolResponse(res) => {
if let Ok(contents) = &res.tool_result {
let text_items: Vec<String> = contents
if let Ok(result) = &res.tool_result {
let text_items: Vec<String> = result
.content
.iter()
.filter_map(|content| {
content.as_text().map(|text_str| text_str.text.clone())
@@ -517,7 +518,12 @@ mod tests {
),
Message::user().with_tool_response(
"tool_0",
Ok(vec![RawContent::text("hello, world").no_annotation()]),
Ok(rmcp::model::CallToolResult {
content: vec![RawContent::text("hello, world").no_annotation()],
structured_content: None,
is_error: Some(false),
meta: None,
}),
),
];
@@ -550,9 +556,12 @@ mod tests {
));
messages.push(Message::user().with_tool_response(
format!("tool_{}", i),
Ok(vec![
RawContent::text(format!("response{}", i)).no_annotation(),
]),
Ok(rmcp::model::CallToolResult {
content: vec![RawContent::text(format!("response{}", i)).no_annotation()],
structured_content: None,
is_error: Some(false),
meta: None,
}),
));
}