feat(apps): Pass toolInfo to MCP Apps via hostContext (#7506)
Co-authored-by: Goose <opensource@block.xyz>
This commit is contained in:
@@ -551,6 +551,9 @@ async fn get_tools(
|
||||
get_parameter_names(&tool),
|
||||
permission,
|
||||
)
|
||||
.with_input_schema(serde_json::Value::Object(
|
||||
tool.input_schema.as_ref().clone(),
|
||||
))
|
||||
})
|
||||
.collect::<Vec<ToolInfo>>();
|
||||
tools.sort_by(|a, b| a.name.cmp(&b.name));
|
||||
|
||||
@@ -548,6 +548,9 @@ pub struct ToolInfo {
|
||||
pub description: String,
|
||||
pub parameters: Vec<String>,
|
||||
pub permission: Option<PermissionLevel>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[schema(value_type = Object)]
|
||||
pub input_schema: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
impl ToolInfo {
|
||||
@@ -562,8 +565,14 @@ impl ToolInfo {
|
||||
description: description.to_string(),
|
||||
parameters,
|
||||
permission,
|
||||
input_schema: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_input_schema(mut self, schema: serde_json::Value) -> Self {
|
||||
self.input_schema = Some(schema);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user