MCPcopy Create free account
hub / github.com/diillson/chatcli / discoverRemoteResources

Method discoverRemoteResources

cli/command_handler_connect.go:195–215  ·  view source on GitHub ↗

discoverRemoteResources fetches remote plugins/agents/skills and registers them.

(ctx context.Context, remoteClient *remote.Client)

Source from the content-addressed store, hash-verified

193
194// discoverRemoteResources fetches remote plugins/agents/skills and registers them.
195func (ch *CommandHandler) discoverRemoteResources(ctx context.Context, remoteClient *remote.Client) {
196 ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
197 defer cancel()
198
199 // Register remote plugins
200 if remotePlugins, err := remoteClient.ListRemotePlugins(ctx); err == nil && len(remotePlugins) > 0 {
201 for _, p := range remotePlugins {
202 rp := remote.NewRemotePluginFromInfo(p, remoteClient)
203 ch.cli.pluginManager.RegisterRemotePlugin(rp)
204 }
205 ch.cli.logger.Info("Remote plugins registered", zap.Int("count", len(remotePlugins)))
206 }
207
208 // Cache remote agents and skills info for listing
209 if agents, err := remoteClient.ListRemoteAgents(ctx); err == nil {
210 ch.cli.remoteAgents = agents
211 }
212 if skills, err := remoteClient.ListRemoteSkills(ctx); err == nil {
213 ch.cli.remoteSkills = skills
214 }
215}
216
217// handleDisconnectCommand handles the /disconnect command.
218// It closes the remote connection and restores the local LLM client.

Callers 1

handleConnectCommandMethod · 0.95

Calls 6

NewRemotePluginFromInfoFunction · 0.92
RegisterRemotePluginMethod · 0.80
ListRemotePluginsMethod · 0.65
InfoMethod · 0.65
ListRemoteAgentsMethod · 0.65
ListRemoteSkillsMethod · 0.65

Tested by

no test coverage detected