MCPcopy Create free account
hub / github.com/AI45Lab/Code / select_tools_for_messages

Function select_tools_for_messages

core/src/tools/selector.rs:69–75  ·  view source on GitHub ↗

Select the tools that should be exposed to the model for this turn. The executor still owns every registered tool. This function only trims the tool definitions sent to the LLM, keeping routine turns small while allowing specialized tools when the prompt asks for them.

(
    tools: &[ToolDefinition],
    messages: &[Message],
)

Source from the content-addressed store, hash-verified

67/// tool definitions sent to the LLM, keeping routine turns small while allowing
68/// specialized tools when the prompt asks for them.
69pub fn select_tools_for_messages(
70 tools: &[ToolDefinition],
71 messages: &[Message],
72) -> Vec<ToolDefinition> {
73 let context = selection_context(messages);
74 select_tools_for_prompt(tools, &context)
75}
76
77pub fn select_tools_for_prompt(tools: &[ToolDefinition], prompt: &str) -> Vec<ToolDefinition> {
78 if tools.is_empty() {

Callers 1

call_llmMethod · 0.85

Calls 2

selection_contextFunction · 0.85
select_tools_for_promptFunction · 0.85

Tested by

no test coverage detected