Skip to content

Commit ff798e7

Browse files
committed
add a comment on where the dynamic tool capability is triggered
1 parent 4808159 commit ff798e7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cmd/mcp-grafana/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,8 @@ func (dt *disabledTools) addTools(s *server.MCPServer) {
109109
func (dt *disabledTools) addToolsDynamically(s *server.MCPServer) *mcpgrafana.DynamicToolManager {
110110
dtm := mcpgrafana.NewDynamicToolManager(s)
111111

112-
// Parse enabled tools list
113112
enabledTools := strings.Split(dt.enabledTools, ",")
114113

115-
// Helper function to check if a tool is enabled
116114
isEnabled := func(toolName string) bool {
117115
// If enabledTools is empty string, no tools should be available
118116
if dt.enabledTools == "" {
@@ -252,7 +250,7 @@ Available Capabilities:
252250
instructions += "\nNote that some of these capabilities may be disabled. Do not try to use features that are not available via tools."
253251
}
254252

255-
// Create server with tool capabilities enabled for dynamic tool discovery
253+
// Create server with tool capabilities based on whether dynamic tools are enabled
256254
var s *server.MCPServer
257255
if dt.dynamicTools {
258256
s = server.NewMCPServer("mcp-grafana", mcpgrafana.Version(),

dynamic_tools.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ func (dtm *DynamicToolManager) EnableToolset(ctx context.Context, name string) e
6262
// when AddTool is called (via the Register method), so we don't need to manually
6363
// send notifications here. This happens because WithToolCapabilities(true) was set
6464
// during server initialization.
65+
<<<<<<< HEAD
6566

67+
=======
68+
>>>>>>> 4df4345 (add a comment on where the dynamic tool capability is triggered)
6669
if toolset.AddFunc != nil {
6770
toolset.AddFunc(dtm.server)
6871
}
@@ -166,6 +169,7 @@ func (dtm *DynamicToolManager) getToolsetInfo(name string) *Toolset {
166169
defer dtm.mu.RUnlock()
167170
return dtm.toolsets[name]
168171
}
172+
<<<<<<< HEAD
169173

170174
// sendToolListChangedNotification sends a proper MCP ToolListChangedNotification
171175
func (dtm *DynamicToolManager) sendToolListChangedNotification(ctx context.Context) {
@@ -186,3 +190,5 @@ func (dtm *DynamicToolManager) sendToolListChangedNotification(ctx context.Conte
186190

187191
slog.Info("Sent tool list changed notification to clients")
188192
}
193+
=======
194+
>>>>>>> 4df4345 (add a comment on where the dynamic tool capability is triggered)

0 commit comments

Comments
 (0)