This change does two things:
1) Reverts executable-target policy to strict ONLINE backend status
- Query target resolution in Query_Tool_Handler is restored to require UPPER(status)='ONLINE' in runtime_mysql_servers/runtime_pgsql_servers.
- This matches expected semantics: non-ONLINE backends should not be considered executable MCP targets.
2) Replaces generic non-executable errors with actionable diagnostics
- Added Query_Tool_Handler::format_target_unavailable_error(target_id).
- All query-tool paths that previously returned the generic:
'Target is not executable by this handler'
now return a reasoned error with context, including:
- target_id
- protocol
- hostgroup_id
- auth_profile_id
- concrete reason (for example: empty db_username in auth profile, or no ONLINE backend in runtime_*_servers)
- Internal logs in get_connection()/get_pgsql_connection() now emit the same detailed reason.
3) Improves MCP endpoint failure logging with SQL/target context
- In MCP_JSONRPC_Resource::handle_tools_call(), failed tool calls now log:
- endpoint/tool/error
- full arguments payload (existing)
- additional parsed details when present:
target_id, schema, sql (trimmed for safety)
- This makes it explicit what SQL was requested when a tool call fails before execution.
4) Protocol normalization retained for robustness
- MCP_Threads_Handler::load_target_auth_map() lowercases protocol values when loading runtime profile joins.
- This avoids protocol-casing drift causing inconsistent routing behavior.
Build validation:
- Successfully recompiled modified objects:
- lib/obj/Query_Tool_Handler.oo
- lib/obj/MCP_Endpoint.oo
- lib/obj/MCP_Thread.oo
Resulting behavior expected on next test run:
- If a target is non-executable, the response and logs will state exactly why (ONLINE/backend/auth reason), instead of a generic error.
- Failure logs will also include the attempted SQL text (for tool calls that carry sql arguments), clarifying whether a backend query was actually executed or blocked before execution.