Files
kb/openspec/changes/bulk-ops-remove-collections/specs/mcp-document-management/spec.md
T
steve b5a203d2aa Add bulk operations and remove collections abstraction
- Add bulk delete, bulk tags, and bulk set-tags engine endpoints
  (POST /api/v1/bulk/delete, /bulk/tags, /bulk/set-tags)
- Filter-based selection: by tags, doc_type, ID list, ID range
- Safety threshold (KB_BULK_SAFETY_PERCENT, default 70%) prevents
  accidental mass operations unless force=true
- Synchronous execution with audit trail via jobs table
- Add kb_bulk_delete, kb_bulk_tags, kb_bulk_set_tags MCP tools
- Add kb bulk-remove, bulk-tag, bulk-set-tags CLI commands
- Remove collection abstraction from MCP server (use tags instead)
- Remove kb_set_collection MCP tool
- Update SKILL.md, MCP.md, README.md documentation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 22:34:47 +01:00

56 lines
2.8 KiB
Markdown

## REMOVED Requirements
### Requirement: Collection abstraction in MCP server
The MCP server SHALL NOT maintain any collection abstraction. The following SHALL be removed:
- Constants: `COLLECTION_TAG_PREFIX`, `DEFAULT_COLLECTION`
- Functions: `_collection_tag`, `_strip_collection_tags`, `_process_document`, `_process_search_results`, `_ensure_exclusive_collection`
- Tool: `kb_set_collection` (entire tool)
- Parameters: `collection` from `kb_search`, `kb_addnote`, `kb_upload_start`
Documents SHALL be returned as-is from the engine with all tags visible. No tag stripping or collection field injection SHALL occur.
#### Scenario: Search results show all tags
- **WHEN** `kb_search` is called and a result has tags `["agent:mybot", "collection:documents", "draft"]`
- **THEN** all three tags SHALL be returned as-is — no stripping of `collection:*` tags
#### Scenario: kb_set_collection no longer exists
- **WHEN** an MCP client attempts to call `kb_set_collection`
- **THEN** the tool SHALL not be found (removed)
## MODIFIED Requirements
### Requirement: kb_search without collection parameter
The `kb_search` MCP tool SHALL accept `tags` (optional list of str) for filtering but SHALL NOT accept a `collection` parameter. Callers that previously used `collection="memory"` SHALL instead use `tags=["collection:memory"]` or whatever tag convention they prefer.
#### Scenario: Filter by tag instead of collection
- **WHEN** `kb_search(query="test", tags=["agent:mybot"])` is called
- **THEN** results SHALL be filtered to documents tagged "agent:mybot"
- **AND** no collection field SHALL be present in the response
### Requirement: kb_addnote without collection parameter
The `kb_addnote` MCP tool SHALL accept `tags` (optional list of str) but SHALL NOT accept a `collection` parameter. The tool SHALL NOT automatically apply any default collection tag — only explicitly provided tags are applied.
#### Scenario: Add note with explicit tags
- **WHEN** `kb_addnote(text="hello", tags=["agent:mybot", "memory"])` is called
- **THEN** the note SHALL be created with exactly those two tags — no `collection:documents` tag added
### Requirement: kb_upload_start without collection parameter
The `kb_upload_start` MCP tool SHALL accept `tags` (optional list of str) but SHALL NOT accept a `collection` parameter. The tool SHALL NOT automatically apply any default collection tag.
### Requirement: kb_update_note without collection processing
The `kb_update_note` MCP tool SHALL return the document as-is from the engine without passing it through `_process_document`. All tags SHALL be visible in the response.
### Requirement: kb_get without collection processing
The `kb_get` MCP tool SHALL return documents as-is from the engine without passing through `_process_document`. All tags SHALL be visible in the response. No `collection` field SHALL be injected.