Commit History
-
[NOTICKET] refactor(tools): single source of truth for data-access tool names + clarify input_schema is presence-onlyβ
R11 (TAB slice): the data-access tool-name set was duplicated between invoker.py and planner/registry.py, synced only by a keep-in-lockstep comment. A 5th/renamed tool added in one place but not the other would silently mis-route (registry knows it, CompositeToolInvoker rejects it). Define canonical DATA_ACCESS_TOOLS once in tools/data_access.py; invoker.py imports it. (planner/registry.py + _PLACEHOLDER_RE dedup are the agent-side remainder.) T1: ToolSpec.input_schema comment said "validates ToolCall.args" but TaskRunner._validate_args is presence-only; properties types are documentation, not enforced. Clarified so nobody assumes type-safety. Doc/comment + a constant move; no behavior change. 41 tool tests pass, ruff clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>90e80f9
-
[KM-630] Data-Access Tools: coerce DB Decimal to floatβ
DB NUMERIC columns arrive as decimal.Decimal (asyncpg). This broke analyze_contribution with a `float + Decimal` TypeError, and the same Decimal would also break JSON serialization (SSE / analysis_record) of query_structured output. - query_structured: _json_safe coerces Decimal -> float when building ToolOutput.rows, so the output is JSON-safe at the source. - _materialize: _coerce_decimals normalizes Decimal object-columns to float64 so the whole analyze_* family receives consistent float input. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1195870 -
[KM-630] Data-Access Tools: review fixesβ
- describe_source: add table_row_count column (the registry tool description advertises row counts; output now matches the contract). - retrieve_documents: coerce top_k to int with a fallback to 5, so a non-int top_k from the Planner can't reach the retriever unguarded. - Refresh the module docstring to list all four tools (query_structured and retrieve_documents were missing). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>37b8384 -
[KM-630] Data-Access Toolsβ
DataAccessToolInvoker (src/tools/data_access.py) β never-throwing invoker for the data-access family, constructed per-request with the authenticated user_id and a CatalogReader (dependency injection; INV-7 keeps the agent layer tool-agnostic). Implements all four tools: - list_sources β user's data sources (id, name, type, table count). - describe_source β tables/columns of one source (metadata only; exposes pii_flag, never sample_values). - query_structured β runs a pre-built QueryIR (validate -> dispatch -> execute, skipping the planner) and returns ToolOutput(kind="table"); this is the Pattern A handoff the analyze_* tools consume. - retrieve_documents β dense retrieval over unstructured sources; optional source_id is a best-effort metadata post-filter (see TODO). CompositeToolInvoker (src/tools/invoker.py) β one invoke(tool_name, args) dispatching the whole tool surface: routes the four data-aβ¦148e33b