Repository navigation
Closed
Labels
Description
Summary
Add a new document_list agent tool that allows the AI agent (and workflow LLM nodes) to query and filter documents from the knowledge base. Currently, the agent has no way to list, filter, or browse documents — it can only search by semantic relevance via rag_search.
Motivation
Many advanced workflows require the agent to identify specific documents before processing them:
- "Find the last 10 contracts uploaded this month"
- "List all documents in folder X"
- "Show me all PDF files tagged with team Y"
Without this tool, the agent cannot perform document-level operations like comparison, batch analysis, or systematic review.
Proposed Tool Design
Tool name: document_list
Registration: Add to agent_tools/tool_names.ts and agent_tools/tool_registry.ts
Input Schema
{
folderPath?: string; // Filter by folder path (e.g., "/contracts/2024")
extension?: string; // Filter by file extension (e.g., "pdf", "docx")
dateFrom?: string; // ISO date string, filter by creation date
dateTo?: string; // ISO date string, filter by creation date
query?: string; // Optional name/title search
sortBy?: "createdAt" | "name"; // Sort order (default: "createdAt")
sortOrder?: "asc" | "desc"; // Sort direction (default: "desc")
limit?: number; // Max results (default: 20, max: 50)
}Output
{
documents: Array<{
id: string;
name: string;
folderPath: string;
extension: string;
createdAt: string; // ISO timestamp
sizeBytes: number;
teamTags: string[];
}>;
totalCount: number;
hasMore: boolean;
}Implementation Notes
- Query the Convex
documentstable directly (no RAG service call needed) - Scope by
organizationIdfrom tool context - Filter by
teamTagsusinguserTeamIdsfrom tool context for access control - Leverage existing indexes on
organizationId + extension - Follow patterns from existing tools like
customer_read_tool.tsandproduct_read_tool.ts
Key Files
services/platform/convex/agent_tools/documents/document_list_tool.ts(new)services/platform/convex/agent_tools/tool_names.ts(register name)services/platform/convex/agent_tools/tool_registry.ts(register tool)services/platform/convex/documents/(existing queries to reference)
Acceptance Criteria
- New
document_listtool registered in tool registry - Supports all filter parameters (folder, extension, date range, query)
- Supports sorting and pagination (limit)
- Respects organization and team-based access control
- Works both as a chat agent tool and in workflow LLM nodes
- Unit tests covering: filtering, sorting, access control, empty results, limit boundaries
Activity
feat(platform): add document_list agent tool
fix(platform): address code review issues in document_list tool
feat(platform): add document_list agent tool
fix(platform): address code review issues in document_list tool
yannickmonney commentedon Apr 7, 2026
This feature is already implemented as
document_findtool atconvex/agent_tools/documents/document_find_tool.ts. It supports all requested filters (folderPath, extension, date range, limit, pagination) with organization scoping. Tests exist at__tests__/document_find_tool.test.ts(24 tests).