24 lines
736 B
Rust
24 lines
736 B
Rust
use crank_registry::PublishedAgentTool;
|
|
use crank_runtime::RuntimeOperation;
|
|
|
|
use super::ResolvedToolCall;
|
|
|
|
pub(crate) fn resolve_generated_tool(
|
|
tools: &[PublishedAgentTool],
|
|
tool_name: &str,
|
|
) -> Option<ResolvedToolCall> {
|
|
tools
|
|
.iter()
|
|
.find(|tool| tool.tool_name == tool_name)
|
|
.cloned()
|
|
.map(|tool| ResolvedToolCall { tool })
|
|
}
|
|
|
|
pub(crate) fn runtime_operation(tool: &PublishedAgentTool) -> RuntimeOperation {
|
|
let mut operation = RuntimeOperation::from(tool.operation.clone());
|
|
operation.tool_name = tool.tool_name.clone();
|
|
operation.tool_description.title = tool.tool_title.clone();
|
|
operation.tool_description.description = tool.tool_description.clone();
|
|
operation
|
|
}
|