MCPcopy
hub / github.com/google/ax / RegisterLocal

Method RegisterLocal

internal/controller/registry.go:53–74  ·  view source on GitHub ↗

RegisterLocal registers a local (in-process) agent.

(cfg config.LocalAgentConfig)

Source from the content-addressed store, hash-verified

51
52// RegisterLocal registers a local (in-process) agent.
53func (r *Registry) RegisterLocal(cfg config.LocalAgentConfig) error {
54 r.mu.Lock()
55 defer r.mu.Unlock()
56
57 if err := validateID(cfg.ID); err != nil {
58 return err
59 }
60
61 if _, ok := r.agents[cfg.ID]; ok {
62 return fmt.Errorf("agent %s already registered", cfg.ID)
63 }
64
65 r.agents[cfg.ID] = cfg.Agent
66 r.agentInfo[cfg.ID] = &agent.AgentInfo{
67 ID: cfg.ID,
68 Name: cfg.Name,
69 Description: cfg.Description,
70 Metadata: cfg.Metadata,
71 }
72
73 return nil
74}
75
76// RegisterRemote registers a remote agent by creating a remote agent client.
77// The protocol field determines what kind of remote agent to register

Callers 1

TestMultiFunction · 0.80

Calls 1

validateIDFunction · 0.85

Tested by 1

TestMultiFunction · 0.64