Repository navigation
Add batch get_properties tool for multiple references - #55
Conversation
New iac_mcp_get_properties_batch tool reduces N get_properties calls to 1 by accepting an array of reference IDs. References from the same app are batched into a single JXA call; different apps run concurrently via Promise.allSettled. Per-reference errors are isolated so one failure does not affect others. - Tool definition in query-tools.ts (6th tool) - getPropertiesBatch() in QueryExecutor with group-by-app concurrency - Handler and dispatch in handlers.ts with type guard validation - Unit tests for happy path, partial failure, empty input, cross-app - Integration tests for reference lifecycle with batch operations - Updated tool counts from 5 to 6 in query-tools and MCP integration tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review: Batch Get Properties ToolI've reviewed PR #55 which adds a batch operation for fetching properties from multiple references. Overall, this is a well-structured implementation with strong security practices and comprehensive test coverage. Below are my findings: ✅ Strengths1. Security Hardening
2. Error Isolation & Resilience
3. Performance Optimization
4. Test Coverage
5. Code Quality
🔍 Observations & Minor Suggestions1. Reference Post-Processing (Lines 793-805)The reference marker conversion logic ( Suggestion: Consider extracting this into a shared helper method like 2. JXA Script Size ConsiderationWhen batching hundreds of references from the same app, the generated JXA script could become very large (each reference adds ~15-20 lines of code). Question: Have you tested or considered a maximum batch size per app group? Most real-world use cases probably won't hit this, but it might be worth documenting or adding a soft limit (e.g., 100 refs per app group). 3. Documentation ClarityThe tool description is excellent and includes great examples. Minor suggestion: explicitly mention that the batch preserves order in the description (it's in the code but not in the user-facing docs). 🎯 Performance AnalysisThe batching strategy is well-designed:
The use of 🛡️ Security AnalysisCommand Injection: ✅ SAFE
Path Traversal: ✅ NOT APPLICABLE
Resource Exhaustion:
|
…scription Address review feedback: - Extract duplicated reference marker conversion logic into shared postProcessPropertyReferences() method used by getProperties, getElementsWithProperties, and getPropertiesBatch - Add order preservation note to batch tool description Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review: Batch Get Properties ToolI've completed a thorough review of PR #55. Overall, this is excellent work that adds significant value while maintaining the project's high quality standards. The implementation is well-architected, secure, and thoroughly tested. ✅ Strengths1. Solid Architecture & Design
2. Security - Excellent ✅
3. Test Coverage - Exceptional ✅The PR includes comprehensive testing:
This meets the project's 100% coverage requirement. 4. TypeScript Type Safety ✅
5. Performance & Resilience
🔍 Minor Observations (Not Blocking)1. JXA Code Duplication (Low Priority)Location: The all-properties JXA generation (lines 667-704) is nearly identical to the existing Impact: Low - the logic is complex and context-specific to batch operations. Extracting might not improve clarity. Recommendation: Consider documenting why this is duplicated (if architectural) or extracting to a shared helper in a future refactor. 2. Edge Case: Empty Properties ArrayLocation: Current behavior: if (properties && properties.length > 0) { ... }Question: What happens if caller passes
Recommendation: Add a test case for 3. Error Message ConsistencyLocation: Two different error messages for missing references:
Impact: Minimal - both are clear and correct for their context. Recommendation: Consider if handler validation should also check format ( 4. Potential for Large BatchesLocation: No explicit limit on batch size. A batch of 1000 references could generate very large JXA scripts. Current mitigation: Individual property/app name validation limits total size Recommendation: Consider adding a configurable
🎯 JITD Architecture AlignmentThis PR perfectly aligns with the JITD philosophy:
📊 Performance AnalysisBefore: Fetching properties for 4 Mail messages
After: Same operation
Improvement: ~2-4x faster for common use cases ✅ Final VerdictAPPROVE with minor suggestions for future iterations. This PR is production-ready:
The minor observations above are not blockers - they're opportunities for incremental polish in future PRs if desired. Great work! 🎉 Optional Follow-ups (Post-Merge)
None of these are urgent or necessary for this PR. |
Summary
iac_mcp_get_properties_batchtool accepts an array of reference IDs and returns all their properties in a single MCP callPromise.allSettledget_propertiescalls to 1 MCP call (common case: 4 selected Mail messages = 1 JXA call instead of 4)Files Changed
src/jitd/tool-generator/query-tools.ts- 6th tool definitionsrc/execution/query-executor.ts-getPropertiesBatch()with group-by-app concurrencysrc/mcp/handlers.ts- Type guard, handler, dispatchTest Plan
🤖 Generated with Claude Code