Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public final class DefaultToolCallingManager implements ToolCallingManager {
private static final ToolExecutionExceptionProcessor DEFAULT_TOOL_EXECUTION_EXCEPTION_PROCESSOR
= DefaultToolExecutionExceptionProcessor.builder().build();

private static final String POSSIBLE_LLM_TOOL_NAME_CHANGE_WARNING
= "LLM may have adapted the tool name '{}', especially if the name was truncated due to length limits. If this is the case, you can customize the prefixing and processing logic using McpToolNamePrefixGenerator";


// @formatter:on

private final ObservationRegistry observationRegistry;
Expand Down Expand Up @@ -109,6 +113,7 @@ public List<ToolDefinition> resolveToolDefinitions(ToolCallingChatOptions chatOp
}
ToolCallback toolCallback = this.toolCallbackResolver.resolve(toolName);
if (toolCallback == null) {
logger.warn(POSSIBLE_LLM_TOOL_NAME_CHANGE_WARNING, toolName);
throw new IllegalStateException("No ToolCallback found for tool name: " + toolName);
}
toolCallbacks.add(toolCallback);
Expand Down Expand Up @@ -207,6 +212,7 @@ private InternalToolExecutionResult executeToolCall(Prompt prompt, AssistantMess
.orElseGet(() -> this.toolCallbackResolver.resolve(toolName));

if (toolCallback == null) {
logger.warn(POSSIBLE_LLM_TOOL_NAME_CHANGE_WARNING, toolName);
throw new IllegalStateException("No ToolCallback found for tool name: " + toolName);
}

Expand Down