feat(mcp): switch to YAML serialization for tool outputs
- Replaced serde_json with serde_yaml in all handler endpoints. - This drastically reduces token consumption for large list/graph responses by removing JSON braces and quotes.
This commit is contained in:
1 parent
410b0c42ca
commit
cb0c55775a
12 files changed
+65
-37
No files matched your search
@@ -40,6 +40,9 @@ pub enum AppError {
|
||||
|
||||
#[error("I/O Error: {0}")]
|
||||
IoError(#[from] std::io::Error),
|
||||
|
||||
#[error("YAML Serialization Error: {0}")]
|
||||
YamlError(#[from] serde_yaml::Error),
|
||||
}
|
||||
|
||||
impl From<AppError> for String {
|
||||
@@ -81,6 +84,10 @@ impl IntoResponse for AppError {
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("I/O Error: {}", e),
|
||||
),
|
||||
AppError::YamlError(e) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("YAML Serialization Error: {}", e),
|
||||
),
|
||||
};
|
||||
|
||||
let body = Json(json!({
|
||||
|
||||
Reference in new issue
Block a user