Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

chore(cli): adapt ListKnowledgeChunks interface to variadic chunk_type filter

nullkeyb395db55dec1
diff --git a/cli/cmd/chunk/list.go b/cli/cmd/chunk/list.go
index a2d26ca1b..a0e3076d5 100644
--- a/cli/cmd/chunk/list.go
+++ b/cli/cmd/chunk/list.go
@@ -36,7 +36,7 @@ var chunkListFields = []string{
// ListService is the narrow SDK surface this command depends on.
type ListService interface {
- ListKnowledgeChunks(ctx context.Context, knowledgeID string, page, pageSize int) ([]sdk.Chunk, int64, error)
+ ListKnowledgeChunks(ctx context.Context, knowledgeID string, page, pageSize int, chunkTypes ...string) ([]sdk.Chunk, int64, error)
}
type ListOptions struct {
diff --git a/cli/cmd/chunk/list_test.go b/cli/cmd/chunk/list_test.go
index 3a5b29276..110c62d5e 100644
--- a/cli/cmd/chunk/list_test.go
+++ b/cli/cmd/chunk/list_test.go
@@ -28,7 +28,7 @@ type fakeListSvc struct {
callIdx int
}
-func (f *fakeListSvc) ListKnowledgeChunks(_ context.Context, docID string, page, pageSize int) ([]sdk.Chunk, int64, error) {
+func (f *fakeListSvc) ListKnowledgeChunks(_ context.Context, docID string, page, pageSize int, _ ...string) ([]sdk.Chunk, int64, error) {
f.calls = append(f.calls, listCall{docID, page, pageSize})
defer func() { f.callIdx++ }()
if f.callIdx >= len(f.pages) {
diff --git a/cli/internal/mcp/tools.go b/cli/internal/mcp/tools.go
index e6274b439..1a46e229a 100644
--- a/cli/internal/mcp/tools.go
+++ b/cli/internal/mcp/tools.go
@@ -92,7 +92,7 @@ type agentService interface {
// separate from knowledgeService because the chunk subtree is its own
// domain on the server side (/api/v1/chunks/...).
type chunkListService interface {
- ListKnowledgeChunks(ctx context.Context, knowledgeID string, page, pageSize int) ([]sdk.Chunk, int64, error)
+ ListKnowledgeChunks(ctx context.Context, knowledgeID string, page, pageSize int, chunkTypes ...string) ([]sdk.Chunk, int64, error)
}
// agentInvokeService composes the two SDK methods agent_invoke needs
diff --git a/cli/internal/mcp/tools_test.go b/cli/internal/mcp/tools_test.go
index 1394540a9..6397e477e 100644
--- a/cli/internal/mcp/tools_test.go
+++ b/cli/internal/mcp/tools_test.go
@@ -128,7 +128,7 @@ func (f *fakeSvc) AgentQAStreamWithRequest(_ context.Context, sess string, req *
}
return f.agentStreamErr
}
-func (f *fakeSvc) ListKnowledgeChunks(_ context.Context, docID string, page, pageSize int) ([]sdk.Chunk, int64, error) {
+func (f *fakeSvc) ListKnowledgeChunks(_ context.Context, docID string, page, pageSize int, _ ...string) ([]sdk.Chunk, int64, error) {
f.calls.chunkDocID = docID
f.calls.chunkPage = page
f.calls.chunkPageSize = pageSize