027.12 Agent Add Source
Description¶
As an AI Agent, I want to add a text source to the current project so that I can programmatically ingest research data without requiring the researcher to manually import files.
This fills the F-002.8 gap identified in the backlog: "Agent cannot add sources." The agent provides text content (and optional metadata), the system creates a new source entry with extracted fulltext, and publishes a SourceAdded domain event.
Trust Level: T3 (Suggest) — Agent proposes, researcher approves. The agent submits source content; the system can either auto-add (for trusted workflows) or queue for approval.
Bounded Context: Sources Layer: Interface (MCP tool)
Acceptance Criteria¶
- [x] #1 MCP tool
add_text_sourceis registered in ProjectTools with proper schema - [x] #2 Agent can provide source name, text content, and optional memo/origin metadata
- [x] #3 Duplicate source names are rejected with a clear failure message
- [x] #4 Source is persisted via
add_text_sourcecommand handler andSourceAddedevent is published - [x] #5 Tool returns the new source ID, name, type, and status on success
- [x] #6 Empty name or empty content is rejected with validation error
- [x] #7 E2E test exists with
@allure.story("QC-027.12 Agent Add Text Source")decorator - [x] #8 Tool schema includes inputSchema with required (name, content) and optional (memo, origin) parameters
Notes¶
- Source type is always
TEXTfor this tool; file-based imports (PDF, image, media) are handled by separate tools