diff --git a/packages/core/src/tools/read-many-files.test.ts b/packages/core/src/tools/read-many-files.test.ts index 0eaba66..0ad9624 100644 --- a/packages/core/src/tools/read-many-files.test.ts +++ b/packages/core/src/tools/read-many-files.test.ts @@ -411,24 +411,32 @@ describe('ReadManyFilesTool', () => { ]); }); - it('should skip PDF files if not explicitly requested by extension or name', async () => { + it('should include PDF files even if not explicitly requested by extension or name', async () => { createBinaryFile('document.pdf', Buffer.from('%PDF-1.4...')); createFile('notes.txt', 'text notes'); const params = { paths: ['*'] }; // Generic glob, not specific to .pdf const invocation = tool.build(params); const result = await invocation.execute(new AbortController().signal); const content = result.llmContent as string[]; - const expectedPath = path.join(tempRootDir, 'notes.txt'); + const expectedPathTxt = path.join(tempRootDir, 'notes.txt'); + const expectedPathPdf = path.join(tempRootDir, 'document.pdf'); expect( content.some( (c) => typeof c === 'string' && - c.includes(`--- ${expectedPath} ---\n\ntext notes\n\n`), + c.includes(`--- ${expectedPathTxt} ---\n\ntext notes\n\n`), + ), + ).toBe(true); + expect( + content.some( + (c) => + typeof c === 'object' && + c.inlineData && + c.inlineData.mimeType === 'application/pdf', ), ).toBe(true); - expect(result.returnDisplay).toContain('**Skipped 1 item(s):**'); expect(result.returnDisplay).toContain( - '- `document.pdf` (Reason: asset file (image/pdf) was not explicitly requested by name or extension)', + 'Successfully read and concatenated content from **3 file(s)**', ); }); diff --git a/packages/core/src/tools/read-many-files.ts b/packages/core/src/tools/read-many-files.ts index 1eed74c..112acdf 100644 --- a/packages/core/src/tools/read-many-files.ts +++ b/packages/core/src/tools/read-many-files.ts @@ -336,29 +336,6 @@ ${finalExclusionPatternsForDescription const fileType = await detectFileType(filePath); - if (fileType === 'image' || fileType === 'pdf') { - const fileExtension = path.extname(filePath).toLowerCase(); - const fileNameWithoutExtension = path.basename( - filePath, - fileExtension, - ); - const requestedExplicitly = inputPatterns.some( - (pattern: string) => - pattern.toLowerCase().includes(fileExtension) || - pattern.includes(fileNameWithoutExtension), - ); - - if (!requestedExplicitly) { - return { - success: false, - filePath, - relativePathForDisplay, - reason: - 'asset file (image/pdf) was not explicitly requested by name or extension', - }; - } - } - // Use processSingleFileContent for all file types now const fileReadResult = await processSingleFileContent( filePath,