1pub mod filesystem;
5pub mod todos;
6pub mod tools;
7
8pub use tools::{create_sync_tool, create_tool};
10
11use agents_core::agent::ToolResponse;
12use agents_core::messaging::{
13 AgentMessage, MessageContent, MessageMetadata, MessageRole, ToolInvocation,
14};
15pub use filesystem::{EditFileTool, LsTool, ReadFileTool, WriteFileTool};
16pub use todos::WriteTodosTool;
17
18pub(crate) fn metadata_from(invocation: &ToolInvocation) -> Option<MessageMetadata> {
19 invocation.tool_call_id.as_ref().map(|id| MessageMetadata {
20 tool_call_id: Some(id.clone()),
21 cache_control: None,
22 })
23}
24
25pub(crate) fn tool_text_response(
26 invocation: &ToolInvocation,
27 message: impl Into<String>,
28) -> ToolResponse {
29 ToolResponse::Message(AgentMessage {
30 role: MessageRole::Tool,
31 content: MessageContent::Text(message.into()),
32 metadata: metadata_from(invocation),
33 })
34}