yyqdbngt opened a new pull request, #2864: URL: https://github.com/apache/rocketmq-dashboard/pull/2864
## Summary - Guard `buildToolInputTemplate()` against tools whose `parameters` object is missing or not an object (defensive read via the existing `isRecord` helper) - Export `buildToolInputTemplate()` for unit testing (same precedent as the `AiMessage` export in this page) - Add unit tests covering schema defaults/enums/type fallbacks, missing/broken `parameters`, and required fields absent from `properties` ## Why Tool metadata comes from the MCP catalog over the wire, so the `McpTool.parameters` shape is not guaranteed. `buildToolInputTemplate()` dereferenced `tool.parameters.required` without a type check: a tool entry with a missing or malformed `parameters` field threw a `TypeError` inside `loadTools()`, failing the whole catalog load (and the automatic first-tool selection) even though every other tool was fine. ## Testing - `./node_modules/.bin/vitest run src/pages/ai/__tests__/` → 17 passed (3 new) - `./node_modules/.bin/tsc --noEmit` → clean - `./node_modules/.bin/eslint src/pages/ai/index.tsx src/pages/ai/__tests__/toolInputTemplate.test.ts` → 0 errors -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
