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