File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
samples/AspNetCoreMcpPerSessionTools Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 18
18
{
19
19
// Configure per-session options to filter tools based on route category
20
20
options . ConfigureSessionOptions = async ( httpContext , mcpOptions , cancellationToken ) =>
21
- {
21
+ {
22
22
// Determine tool category from route parameters
23
23
var toolCategory = GetToolCategoryFromRoute ( httpContext ) ;
24
24
29
29
return ;
30
30
}
31
31
32
+ // Clear tools (we add them to make sure the capability is initialized)
33
+ toolCollection . Clear ( ) ;
34
+
32
35
// Get pre-populated tools for the requested category
33
36
if ( toolDictionary . TryGetValue ( toolCategory . ToLower ( ) , out var tools ) )
34
37
{
38
41
}
39
42
}
40
43
} ;
41
- } ) ;
44
+ } )
45
+ . WithTools < ClockTool > ( )
46
+ . WithTools < CalculatorTool > ( )
47
+ . WithTools < UserInfoTool > ( ) ;
42
48
43
49
// Add OpenTelemetry for observability
44
50
builder . Services . AddOpenTelemetry ( )
You can’t perform that action at this time.
0 commit comments