Skip to content

Commit 6678035

Browse files
shishuiwuhen2009ilayaperumalg
authored andcommitted
Expose original tool name in Sync/Async tool callback
Add getOriginalToolName method for Sync/AsyncMcpToolCallback in order to get easy access to the 'original' toolname before the prefix was added Signed-off-by: shishuiwuhen2009 <[email protected]>
1 parent 01c4b14 commit 6678035

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

mcp/common/src/main/java/org/springframework/ai/mcp/AsyncMcpToolCallback.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ public ToolDefinition getToolDefinition() {
9696
.build();
9797
}
9898

99+
public String getOriginalToolName() {
100+
return this.tool.name();
101+
}
102+
99103
/**
100104
* Executes the tool with the provided input asynchronously.
101105
* <p>

mcp/common/src/main/java/org/springframework/ai/mcp/SyncMcpToolCallback.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ public ToolDefinition getToolDefinition() {
101101
.build();
102102
}
103103

104+
public String getOriginalToolName() {
105+
return this.tool.name();
106+
}
107+
104108
/**
105109
* Executes the tool with the provided input.
106110
* <p>

0 commit comments

Comments
 (0)