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 @@ -591,6 +591,30 @@ func (s *MCPServer) SetTools(tools ...ServerTool) {
591591 s .AddTools (tools ... )
592592}
593593
594+ // GetTool retrieves the specified tool
595+ func (s * MCPServer ) GetTool (toolName string ) * ServerTool {
596+ s .toolsMu .RLock ()
597+ defer s .toolsMu .RUnlock ()
598+ if tool , ok := s .tools [toolName ]; ok {
599+ return & tool
600+ }
601+ return nil
602+ }
603+
604+ func (s * MCPServer ) ListTools () map [string ]* ServerTool {
605+ s .toolsMu .RLock ()
606+ defer s .toolsMu .RUnlock ()
607+ if len (s .tools ) == 0 {
608+ return nil
609+ }
610+ // Create a copy to prevent external modification
611+ toolsCopy := make (map [string ]* ServerTool , len (s .tools ))
612+ for name , tool := range s .tools {
613+ toolsCopy [name ] = & tool
614+ }
615+ return toolsCopy
616+ }
617+
594618// DeleteTools removes tools from the server
595619func (s * MCPServer ) DeleteTools (names ... string ) {
596620 s .toolsMu .Lock ()
You can’t perform that action at this time.
0 commit comments