Commit e4926e5
refactor: improve ToolCallbackProvider injection using ObjectProvider
Replace direct List<ToolCallbackProvider> injection with ObjectProvider
pattern for better flexibility and backward compatibility in tool callback
autoconfiguration.
- Use ObjectProvider<List<ToolCallbackProvider>> and
ObjectProvider<ToolCallbackProvider> for flexible bean resolution
- Add merging and de-duplication logic for ToolCallbackProvider instances
from multiple sources
- Update StatelessToolCallbackConverterAutoConfiguration with new provider
handling in syncTools() and asyncTools() methods
- Update ToolCallbackConverterAutoConfiguration with similar provider
handling improvements
- Enhance ToolCallingAutoConfiguration toolCallbackResolver() to support
both legacy List injection and new ObjectProvider pattern
- Add test coverage
Co-authored-by: Yanming Zhou <[email protected]>
Signed-off-by: Christian Tzolov <[email protected]>1 parent 9cec4d7 commit e4926e5
File tree
4 files changed
+350
-27
lines changed- auto-configurations
- mcp/spring-ai-autoconfigure-mcp-server-common/src/main/java/org/springframework/ai/mcp/server/common/autoconfigure
- models/tool/spring-ai-autoconfigure-model-tool/src
- main/java/org/springframework/ai/model/tool/autoconfigure
- test/java/org/springframework/ai/model/tool/autoconfigure
4 files changed
+350
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | | - | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | | - | |
| 89 | + | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| |||
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
110 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
111 | 124 | | |
112 | 125 | | |
113 | 126 | | |
114 | 127 | | |
115 | 128 | | |
116 | 129 | | |
117 | 130 | | |
118 | | - | |
| 131 | + | |
119 | 132 | | |
120 | 133 | | |
121 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | | - | |
| 63 | + | |
| 64 | + | |
56 | 65 | | |
57 | 66 | | |
58 | 67 | | |
| |||
63 | 72 | | |
64 | 73 | | |
65 | 74 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| |||
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
86 | | - | |
87 | | - | |
| 92 | + | |
| 93 | + | |
88 | 94 | | |
89 | | - | |
| 95 | + | |
| 96 | + | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
| |||
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
117 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
118 | 134 | | |
119 | 135 | | |
120 | 136 | | |
121 | 137 | | |
122 | 138 | | |
123 | 139 | | |
124 | 140 | | |
125 | | - | |
| 141 | + | |
126 | 142 | | |
127 | 143 | | |
128 | 144 | | |
| |||
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
76 | 90 | | |
77 | 91 | | |
78 | 92 | | |
| |||
0 commit comments