feat(platform): consolidate excel tool and remove resource_check#471
Conversation
Rename generate_excel to excel, add parseExcel support for reading uploaded .xlsx files, and remove the unused resource_check tool.
Greptile SummaryThis PR consolidates Excel file handling by merging Key changes:
The refactor maintains backward compatibility for the generate operation while adding new parse capabilities. All tool references have been updated consistently across the codebase. Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| services/platform/convex/agent_tools/files/excel_tool.ts | New consolidated Excel tool with generate and parse operations; comprehensive error handling and clear documentation |
| services/platform/convex/node_only/documents/internal_actions.ts | Added parseExcel action to read Excel files from storage and extract sheet data |
| services/platform/convex/agent_tools/tool_registry.ts | Updated imports and registry to replace generate_excel with excel, removed resource_check |
| services/platform/app/features/custom-agents/components/tool-selector.tsx | Moved excel from Data category to Documents, removed resource_check from UI |
Flowchart
flowchart TD
A[Agent calls excel tool] --> B{operation type?}
B -->|generate default| C[Validate fileName & sheets]
B -->|parse| D[Validate fileId]
C --> E[Call generateExcel action]
E --> F[Build XLSX workbook with xlsx library]
F --> G[Return base64 encoded file]
G --> H[Decode to Uint8Array]
H --> I[Store blob in Convex storage]
I --> J[Return fileId, URL, metadata]
D --> K[Call parseExcel action]
K --> L[Fetch file from storage]
L --> M[Parse with xlsx library]
M --> N[Extract sheets with headers & rows]
N --> O[Return structured sheet data]
Last reviewed commit: 3ff05df
📝 WalkthroughWalkthroughThis PR consolidates Excel file handling and eliminates resource checking functionality. It replaces two separate tools (generate_excel and resource_check) with a unified excel tool that supports both generation and parsing of Excel files via a dual-operation handler. Supporting changes cascade across tool registries, agent configurations, UI component mappings, i18n translations, and internal action handlers to reflect the new tool structure. Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@services/platform/convex/agent_tools/files/excel_tool.ts`:
- Around line 221-229: The current return block sets success: true even if
ctx.storage.getUrl(fileId) returns null (url becomes ''), which can mislead the
agent; update the logic in the generate flow that uses
ctx.storage.getUrl(fileId) to check for a null/undefined url and either throw an
Error or return success: false with an error message instead of returning an
empty url string — specifically guard around ctx.storage.getUrl(fileId) and
modify the returned object (operation:'generate', fileId, url, fileName:
result.fileName, rowCount: result.rowCount, sheetCount: result.sheetCount) to
only set success: true when url is present, otherwise set success:false and
include an explanatory error field or throw so callers (and the agent) do not
receive an empty URL.
- Around line 161-177: The parse branch returns a failure object while generate
currently throws; make them consistent by catching exceptions in the generate
operation and returning a GenerateExcelResult with success: false and an error
string (mirror the fields used in the parse return such as
fileName/operation/sheets/totalRows/sheetCount), and update the
GenerateExcelResult type to include an optional error?: string field; also
ensure you log the error (console.error) with contextual fields like args.fileId
or args.filename before returning.
Summary
generate_exceltool into a unifiedexceltool that supports both generating and parsing.xlsxfilesparseoperation to read uploaded Excel files and extract structured sheet data (headers + rows)resource_checktool and its helper (check_resource_accessible)Test plan
.xlsxfrom tabular data).xlsxfile and confirm the agent extracts sheet data correctlyresource_checktool is fully removed with no remaining referencesexcelunder Documents and no longer showsresource_checkorgenerate_excel🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Chores