File tree Expand file tree Collapse file tree 2 files changed +445
-0
lines changed Expand file tree Collapse file tree 2 files changed +445
-0
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,28 @@ func (s *MCPServer) SetTools(tools ...ServerTool) {
493493 s .AddTools (tools ... )
494494}
495495
496+ // GetTools retrieves the specified tool
497+ func (s * MCPServer ) GetTool (toolName string ) * ServerTool {
498+ s .toolsMu .RLock ()
499+ defer s .toolsMu .RUnlock ()
500+ tool := s .tools [toolName ]
501+ return & tool
502+ }
503+
504+ func (s * MCPServer ) ListTools () map [string ]* ServerTool {
505+ s .toolsMu .RLock ()
506+ defer s .toolsMu .RUnlock ()
507+ if len (s .tools ) == 0 {
508+ return nil
509+ }
510+ // Create a copy to prevent external modification
511+ toolsCopy := make (map [string ]* ServerTool , len (s .tools ))
512+ for name , tool := range s .tools {
513+ toolsCopy [name ] = & tool
514+ }
515+ return toolsCopy
516+ }
517+
496518// DeleteTools removes tools from the server
497519func (s * MCPServer ) DeleteTools (names ... string ) {
498520 s .toolsMu .Lock ()
You can’t perform that action at this time.
0 commit comments