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

Method List

cli/knowledge_adapter.go:103–118  ·  view source on GitHub ↗

List describes the attached knowledge bases.

()

Source from the content-addressed store, hash-verified

101
102// List describes the attached knowledge bases.
103func (a *knowledgePluginAdapter) List() (string, error) {
104 mgr := a.manager()
105 if mgr == nil {
106 return "", fmt.Errorf("context manager unavailable in this session")
107 }
108 kbs := mgr.AttachedKnowledge(a.sessionID())
109 if len(kbs) == 0 {
110 return "No knowledge base attached. Create one with /context create <name> <corpus.jsonl|dir> --mode knowledge, then /context attach <name>.", nil
111 }
112 var b strings.Builder
113 fmt.Fprintf(&b, "%d knowledge base(s) attached:\n", len(kbs))
114 for _, fc := range kbs {
115 fmt.Fprintf(&b, "- %s — %d passage(s), %.2f MB indexed\n", fc.Name, fc.FileCount, float64(fc.TotalSize)/1024/1024)
116 }
117 return strings.TrimRight(b.String(), "\n"), nil
118}
119
120// knowledgeAgentBlock renders the knowledge digests for the agent/coder
121// system prompt: the index cards plus the pull instruction. Empty when no

Calls 5

managerMethod · 0.95
sessionIDMethod · 0.95
ErrorfMethod · 0.80
AttachedKnowledgeMethod · 0.80
StringMethod · 0.45