@@ -30,6 +30,7 @@ type mcpClient interface {
3030
3131// Toolset represents a set of MCP tools
3232type Toolset struct {
33+ name string
3334 mcpClient mcpClient
3435 logID string
3536 instructions string
@@ -39,20 +40,22 @@ type Toolset struct {
3940var _ tools.ToolSet = (* Toolset )(nil )
4041
4142// NewToolsetCommand creates a new MCP toolset from a command.
42- func NewToolsetCommand (command string , args , env []string , cwd string ) * Toolset {
43+ func NewToolsetCommand (name , command string , args , env []string , cwd string ) * Toolset {
4344 slog .Debug ("Creating Stdio MCP toolset" , "command" , command , "args" , args )
4445
4546 return & Toolset {
47+ name : name ,
4648 mcpClient : newStdioCmdClient (command , args , env , cwd ),
4749 logID : command ,
4850 }
4951}
5052
5153// NewRemoteToolset creates a new MCP toolset from a remote MCP Server.
52- func NewRemoteToolset (url , transport string , headers map [string ]string ) * Toolset {
54+ func NewRemoteToolset (name , url , transport string , headers map [string ]string ) * Toolset {
5355 slog .Debug ("Creating Remote MCP toolset" , "url" , url , "transport" , transport , "headers" , headers )
5456
5557 return & Toolset {
58+ name : name ,
5659 mcpClient : newRemoteClient (url , transport , headers , NewInMemoryTokenStore (), false ),
5760 logID : url ,
5861 }
@@ -139,8 +142,13 @@ func (ts *Toolset) Tools(ctx context.Context) ([]tools.Tool, error) {
139142 return nil , err
140143 }
141144
145+ name := t .Name
146+ if ts .name != "" {
147+ name = fmt .Sprintf ("%s_%s" , ts .name , name )
148+ }
149+
142150 tool := tools.Tool {
143- Name : t . Name ,
151+ Name : name ,
144152 Description : t .Description ,
145153 Parameters : t .InputSchema ,
146154 OutputSchema : t .OutputSchema ,
@@ -151,7 +159,7 @@ func (ts *Toolset) Tools(ctx context.Context) ([]tools.Tool, error) {
151159 }
152160 toolsList = append (toolsList , tool )
153161
154- slog .Debug ("Added MCP tool" , "tool" , t . Name )
162+ slog .Debug ("Added MCP tool" , "tool" , name )
155163 }
156164
157165 slog .Debug ("Listed MCP tools" , "count" , len (toolsList ))
0 commit comments