Skip to content

feat(mcp): add list and get tools for action log and tasks#6

Open
hbrooks wants to merge 13 commits into
masterfrom
demo/pr-40344
Open

feat(mcp): add list and get tools for action log and tasks#6
hbrooks wants to merge 13 commits into
masterfrom
demo/pr-40344

Conversation

@hbrooks

@hbrooks hbrooks commented May 28, 2026

Copy link
Copy Markdown

Originally PR apache#40344 in apache/superset by @aminghadersohi

aminghadersohi and others added 13 commits May 26, 2026 17:26
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The injected 7-day default filter used a datetime object as the value,
but ActionLogFilter.value only allows str|int|float|bool|list. Pydantic
rejects the datetime when building the filters_applied list in
ActionLogList, causing a ValidationError on every call that triggered
the default filter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add model_serializer to ActionLogInfo and TaskInfo that drops
  non-requested fields from output when select_columns context is set,
  matching the DatabaseInfo pattern
- Switch list_action_logs and list_tasks to return model_dump with
  serialization context so only requested columns appear in responses
- Add search field + search-XOR-filters validator to
  ListActionLogsRequest and ListTasksRequest
- Pass search=request.search through to ModelListCore.run_tool()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rage

- Add task_key and task_name fields to TaskInfo schema and ALL_TASK_COLUMNS;
  these are real Task model columns present in the REST API search_columns
- Expand search_columns in list_tasks to include task_key and task_name
- Strengthen test_list_action_logs_default_7day_filter_applied to also
  assert the injected filter appears in filters_applied with an ISO string value

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pydantic v2 rejects a ColumnOperator instance when validating
list[ActionLogFilter] — it requires an exact instance or dict, not
a parent-class instance. The injected 7-day default dttm filter was
created as a plain ColumnOperator, causing every test_list_action_logs_*
call to fail with '1 validation error for ActionLogList'.

Fix: construct the default filter as ActionLogFilter (which is a
subclass of ColumnOperator), so it passes pydantic validation for
ActionLogList.filters_applied: list[ActionLogFilter] and is still
accepted everywhere ColumnOperator is expected.
…ests

- Normalize changed_on/created_on naive datetimes in serialize_task_object (mirrors
  serialize_action_log_object pattern for dttm)
- Add filter-forwarding assertion to test_list_tasks_with_status_filter
- Add id_column="uuid" assertion to test_get_task_info_by_uuid

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…permissions

The ADMIN-ONLY label was misleading — access is gated by the Log
permission in Superset's RBAC, not a hard admin check.  Updated both
docstrings to describe the actual permission model.
…docs

- Add model_validator to ActionLogFilter to parse ISO string dttm values
  to timezone-aware datetime objects, preventing VARCHAR bind mismatch on
  Postgres TIMESTAMP columns (Pydantic's left-to-right union keeps strings
  as str when str precedes datetime in the union)
- Feed config-guard removed tools (action-log, task) into disabled_tools
  before calling get_default_instructions so removed tools are never
  advertised in LLM instructions
- Add Action Logs and Task Management sections to get_default_instructions
  output; existing per-line filtering strips them when tools are disabled
- Update test assertions and add new coverage for both behaviors
The stored log `json` field is user-controlled data.  Parse it and run
each string leaf through `sanitize_for_llm_context` so the payload
cannot masquerade as instructions when placed in an LLM context.

Preserves the JSON shape (dict/list structure) so callers can still
inspect individual fields; only string leaves are wrapped in
UNTRUSTED-CONTENT delimiters.  Falls back to sanitizing the raw
string when the payload is not valid JSON.

Addresses review feedback from richardfogaca.
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.

2 participants