Skip to content

[Recon-Chatbot] Call Recon methods directly instead of using HTTP-calls.#10524

Draft
ArafatKhan2198 wants to merge 4 commits into
apache:masterfrom
ArafatKhan2198:mcp-design
Draft

[Recon-Chatbot] Call Recon methods directly instead of using HTTP-calls.#10524
ArafatKhan2198 wants to merge 4 commits into
apache:masterfrom
ArafatKhan2198:mcp-design

Conversation

@ArafatKhan2198

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR refactors the Recon chatbot so it fetches cluster data by calling Recon methods in-process, instead of making HTTP requests back to the same Recon server.

Previously, the chatbot ran inside the Recon JVM but still used the Recon REST API to answer questions. That added unnecessary overhead: URL construction, HTTP handling, and response parsing for data Recon already exposes in Java.

This change introduces a direct query path (ReconQueryExecutorReconEndpointRouter, and related helpers) that maps LLM-selected tools to the corresponding Recon logic. LangChain4j native tool-calling is used end to end for tool selection and execution. The old HTTP-based tool executor and OpenAPI-driven prompt resources are removed in favor of a simpler tool semantics model.

Existing safety behavior is preserved: only allowlisted tools can run, query limits are enforced, and scoped queries (for example, bucket-scoped key listing) still apply. The public Recon REST API used by the UI is unchanged.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15570

How was this patch tested?

  • Unit tests added/updated for the chatbot agent, LLM routing, and direct Recon query path (TestReconQueryExecutorTestReconEndpointRouterTestReconApiAllowlistTestLlmRouting, and related agent/LLM tests)
  • Existing chatbot tests updated to reflect the new direct-call flow

ArafatKhan2198 and others added 4 commits June 16, 2026 13:56
Use validateToolCall/validateToolCalls for pre-execution checks, raise
summarization max_tokens for reasoning models, and handle null provider text.

Co-authored-by: Cursor <cursoragent@cursor.com>
…trics tool, and improve tool semantics.

- Introduce GenParams (typed temperature + maxTokens) to replace untyped Map<String,Object>
  parameter passing; delete four dead parse helpers in LangChain4jDispatcher.
- Decompose chatWithTools into buildChatRequest / toLangChain4jToolSpecs / invokeModel /
  toLLMResponse private helpers; merge chatWithTools into a single chatCompletion method.
- Rename getToolCall → chooseToolsForQuery for clarity.
- Inline ReconQueryRequest (single-use DTO); ReconQueryExecutor now accepts (toolName, params)
  directly.
- Remove write-only LLMResponse.metadata field; retype ReconQueryResult.responseBody to JsonNode;
  delete dead ChatbotUtils.extractFirstJsonObject and its test class.
- Replace if/else if chain in ReconEndpointRouter with a switch; extract dense multi-arg dispatch
  branches into named helpers; fix checkstyle (import order, missing braces, long lines).
- Remove api_v1_metrics_api tool (Prometheus proxy): drop from allowlist, LlmToolSpecFactory,
  router, and test fixtures; router is now entirely in-JVM.
- Rewrite recon-tool-semantics.md as a method-call/tool-selection guide: endpoint-by-endpoint
  coverage, explicit open-vs-committed/FSO-trap and task-status disambiguation, parameter
  extraction rules, behavior-honesty contract (1000-record cap, not-randomized), and a
  ~55-row regression test matrix.
- Update test fixtures for all signature changes; delete TestChatbotAgentJsonExtraction.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant