Skip to content

Abilities Explorer: Add a filter to customize the Ability Table class and expose ability meta#714

Draft
i-anubhav-anand wants to merge 1 commit into
WordPress:developfrom
i-anubhav-anand:add/abilities-explorer-table-class-filter
Draft

Abilities Explorer: Add a filter to customize the Ability Table class and expose ability meta#714
i-anubhav-anand wants to merge 1 commit into
WordPress:developfrom
i-anubhav-anand:add/abilities-explorer-table-class-filter

Conversation

@i-anubhav-anand

@i-anubhav-anand i-anubhav-anand commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #203

Adds an extensibility hook so plugins can provide their own Ability_Table subclass for the Abilities Explorer list table, and exposes each ability's meta at the top level of the formatted ability data so custom columns can render metadata.

Why?

There is currently no way for third-party plugins to add custom columns to the Abilities Explorer table without modifying plugin files. The motivating use case from the issue: displaying which abilities support MCP directly in the table view.

How?

  • Adds a wpai_abilities_explorer_table_class filter in Admin_Page::render_list_view(). The issue proposed ai_abilities_explorer_table_class, but this PR follows the plugin's existing wpai_ filter prefix convention (wpai_settings_feature_metadata, wpai_ability_category, …). The filtered value is validated with is_a( $table_class, Ability_Table::class, true ) and silently falls back to the default class, so a bad filter return can't fatal the admin page.
  • Ability_Handler::format_single_ability() now includes 'meta' => $meta at the top level. The copy nested in raw_data is kept for backwards compatibility.
  • Adds an integration test registering an ability with meta and asserting it is exposed at the top level.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable 5
Used for: Implementation and test drafting under my direction; I reviewed the changes and take responsibility for them.

Testing Instructions

  1. Activate the AI plugin and enable the Abilities Explorer experiment.
  2. Add a small mu-plugin that subclasses Ability_Table, adds a column reading $item['meta'], and returns the subclass name from the wpai_abilities_explorer_table_class filter.
  3. Visit Tools → Abilities Explorer and confirm the custom column renders.
  4. Return a non-existent class name from the filter and confirm the page still renders with the default table (graceful fallback).
  5. Run npm run test:php -- --filter Ability_HandlerTest and confirm the new test_get_ability_includes_meta_at_top_level test passes.
Open WordPress Playground Preview

…ity meta

Adds a wpai_abilities_explorer_table_class filter so plugins can provide
a subclass of Ability_Table (e.g. to add custom columns), and includes
the ability meta at the top level of formatted abilities so custom
columns can render metadata without reaching into raw_data.

Closes WordPress#203
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.

Add extensibility hook for custom Ability Table columns

1 participant