Skip to content

Commit 0632cd5

Browse files
authored
refactor: rename ToolCallService trait to ExecutableTool and update references (#291)
1 parent 84a1782 commit 0632cd5

27 files changed

Lines changed: 47 additions & 47 deletions

crates/forge_app/src/service/tool_service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ mod test {
113113
// Mock tool that always succeeds
114114
struct SuccessTool;
115115
#[async_trait::async_trait]
116-
impl forge_domain::ToolCallService for SuccessTool {
116+
impl forge_domain::ExecutableTool for SuccessTool {
117117
type Input = Value;
118118

119119
async fn call(&self, input: Self::Input) -> Result<String, String> {
@@ -124,7 +124,7 @@ mod test {
124124
// Mock tool that always fails
125125
struct FailureTool;
126126
#[async_trait::async_trait]
127-
impl forge_domain::ToolCallService for FailureTool {
127+
impl forge_domain::ExecutableTool for FailureTool {
128128
type Input = Value;
129129

130130
async fn call(&self, _input: Self::Input) -> Result<String, String> {
@@ -198,7 +198,7 @@ mod test {
198198
// Mock tool that simulates a long-running task
199199
struct SlowTool;
200200
#[async_trait::async_trait]
201-
impl forge_domain::ToolCallService for SlowTool {
201+
impl forge_domain::ExecutableTool for SlowTool {
202202
type Input = Value;
203203

204204
async fn call(&self, _input: Self::Input) -> Result<String, String> {

crates/forge_domain/src/tool.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use schemars::JsonSchema;
22
use serde_json::Value;
33

4-
use crate::{NamedTool, ToolCallService, ToolDefinition, ToolDescription};
4+
use crate::{ExecutableTool, NamedTool, ToolDefinition, ToolDescription};
55

66
struct JsonTool<T>(T);
77

@@ -12,7 +12,7 @@ impl<T> JsonTool<T> {
1212
}
1313

1414
#[async_trait::async_trait]
15-
impl<T: ToolCallService + Sync> ToolCallService for JsonTool<T>
15+
impl<T: ExecutableTool + Sync> ExecutableTool for JsonTool<T>
1616
where
1717
T::Input: serde::de::DeserializeOwned + JsonSchema,
1818
{
@@ -25,13 +25,13 @@ where
2525
}
2626

2727
pub struct Tool {
28-
pub executable: Box<dyn ToolCallService<Input = Value> + Send + Sync + 'static>,
28+
pub executable: Box<dyn ExecutableTool<Input = Value> + Send + Sync + 'static>,
2929
pub definition: ToolDefinition,
3030
}
3131

3232
impl<T> From<T> for Tool
3333
where
34-
T: ToolCallService + ToolDescription + NamedTool + Send + Sync + 'static,
34+
T: ExecutableTool + ToolDescription + NamedTool + Send + Sync + 'static,
3535
T::Input: serde::de::DeserializeOwned + JsonSchema,
3636
{
3737
fn from(tool: T) -> Self {

crates/forge_domain/src/tool_definition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use schemars::schema::RootSchema;
55
use schemars::JsonSchema;
66
use serde::{Deserialize, Serialize};
77

8-
use crate::{NamedTool, ToolCallService, ToolName, UsageParameterPrompt, UsagePrompt};
8+
use crate::{ExecutableTool, NamedTool, ToolName, UsageParameterPrompt, UsagePrompt};
99

1010
///
1111
/// Refer to the specification over here:
@@ -59,7 +59,7 @@ impl ToolDefinition {
5959

6060
impl<T> From<&T> for ToolDefinition
6161
where
62-
T: NamedTool + ToolCallService + ToolDescription + Send + Sync + 'static,
62+
T: NamedTool + ExecutableTool + ToolDescription + Send + Sync + 'static,
6363
T::Input: serde::de::DeserializeOwned + JsonSchema,
6464
{
6565
fn from(t: &T) -> Self {

crates/forge_domain/src/tool_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use serde::de::DeserializeOwned;
33
use crate::{ToolCallFull, ToolDefinition, ToolResult};
44

55
#[async_trait::async_trait]
6-
pub trait ToolCallService {
6+
pub trait ExecutableTool {
77
type Input: DeserializeOwned;
88

99
async fn call(&self, input: Self::Input) -> Result<String, String>;

crates/forge_tool/src/approve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::Result;
2-
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
2+
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
33
use forge_tool_macros::ToolDescription;
44
use inquire::Confirm;
55
use schemars::JsonSchema;
@@ -37,7 +37,7 @@ impl NamedTool for Approve {
3737
}
3838

3939
#[async_trait::async_trait]
40-
impl ToolCallService for Approve {
40+
impl ExecutableTool for Approve {
4141
type Input = ApproveInput;
4242

4343
async fn call(&self, input: ApproveInput) -> Result<String, String> {

crates/forge_tool/src/ask.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
1+
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
22
use forge_tool_macros::ToolDescription;
33
use schemars::JsonSchema;
44
use serde::Deserialize;
@@ -24,7 +24,7 @@ impl NamedTool for AskFollowUpQuestion {
2424
}
2525

2626
#[async_trait::async_trait]
27-
impl ToolCallService for AskFollowUpQuestion {
27+
impl ExecutableTool for AskFollowUpQuestion {
2828
type Input = AskFollowUpQuestionInput;
2929

3030
async fn call(&self, input: Self::Input) -> Result<String, String> {

crates/forge_tool/src/fetch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anyhow::{anyhow, Result};
2-
use forge_domain::{NamedTool, ToolCallService, ToolDescription};
2+
use forge_domain::{ExecutableTool, NamedTool, ToolDescription};
33
use forge_tool_macros::ToolDescription;
44
use reqwest::{Client, Url};
55
use schemars::JsonSchema;
@@ -141,7 +141,7 @@ impl Fetch {
141141
}
142142

143143
#[async_trait::async_trait]
144-
impl ToolCallService for Fetch {
144+
impl ExecutableTool for Fetch {
145145
type Input = FetchInput;
146146

147147
async fn call(&self, input: Self::Input) -> Result<String, String> {

crates/forge_tool/src/fs/file_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::Path;
22

33
use anyhow::Context;
4-
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
4+
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
55
use forge_tool_macros::ToolDescription;
66
use schemars::JsonSchema;
77
use serde::Deserialize;
@@ -29,7 +29,7 @@ impl NamedTool for FSFileInfo {
2929
}
3030

3131
#[async_trait::async_trait]
32-
impl ToolCallService for FSFileInfo {
32+
impl ExecutableTool for FSFileInfo {
3333
type Input = FSFileInfoInput;
3434

3535
async fn call(&self, input: Self::Input) -> Result<String, String> {

crates/forge_tool/src/fs/fs_find.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashSet;
22
use std::path::Path;
33

4-
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
4+
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
55
use forge_tool_macros::ToolDescription;
66
use forge_walker::Walker;
77
use regex::Regex;
@@ -36,7 +36,7 @@ impl NamedTool for FSSearch {
3636
}
3737

3838
#[async_trait::async_trait]
39-
impl ToolCallService for FSSearch {
39+
impl ExecutableTool for FSSearch {
4040
type Input = FSSearchInput;
4141

4242
async fn call(&self, input: Self::Input) -> Result<String, String> {

crates/forge_tool/src/fs/fs_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::Path;
22

33
use anyhow::Context;
4-
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
4+
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
55
use forge_tool_macros::ToolDescription;
66
use forge_walker::Walker;
77
use schemars::JsonSchema;
@@ -36,7 +36,7 @@ impl NamedTool for FSList {
3636
}
3737

3838
#[async_trait::async_trait]
39-
impl ToolCallService for FSList {
39+
impl ExecutableTool for FSList {
4040
type Input = FSListInput;
4141

4242
async fn call(&self, input: Self::Input) -> Result<String, String> {

0 commit comments

Comments
 (0)