Problem
db-optimize always optimizes ALL database tables, ignoring user intent to target specific tables.
Tool selection works correctly (verified in PR #102 tests), but the ability lacks a tables input parameter.
Current behavior
The PHP backend (includes/abilities/db-optimize.php) runs SHOW TABLES and optimizes every table unconditionally. The input_schema has no properties — it accepts no parameters.
Proposed fix
PHP: Add tables input parameter
'input_schema' => array(
'type' => 'object',
'default' => array(),
'properties' => array(
'tables' => array(
'type' => 'array',
'items' => array( 'type' => 'string' ),
'description' => 'Specific table names to optimize. If empty, optimizes all tables.',
),
),
'additionalProperties' => false,
),
In the execute callback:
- If
tables is provided, validate each name exists, then optimize only those
- If
tables is empty/missing, optimize all (current behavior)
- Security: validate table names against actual database tables to prevent SQL injection
JS: Extract table names from user message
The execute function should extract table names from the user message and pass them as the tables parameter. This could be done via:
- LLM args — the LLM already receives the user message and could populate
args.tables if the system prompt describes the parameter
- JS-side extraction — regex to pull table names (anything matching
wp_* patterns)
WooCommerce awareness (#73)
For "optimize the WooCommerce tables", the ability should know which tables belong to WooCommerce. Options:
Example user queries
- "optimize the database table wp_options" → optimize only
wp_options
- "optimize wp_posts and wp_postmeta" → optimize those two
- "optimize the WooCommerce tables" → optimize all WC-related tables
- "optimize the database" → optimize all (current behavior, unchanged)
Files to modify
includes/abilities/db-optimize.php — add tables param, filter logic
src/extensions/abilities/db-optimize.js — extract table names or rely on LLM args
Refs
Closes #69, closes #73
Problem
db-optimizealways optimizes ALL database tables, ignoring user intent to target specific tables.Tool selection works correctly (verified in PR #102 tests), but the ability lacks a
tablesinput parameter.Current behavior
The PHP backend (
includes/abilities/db-optimize.php) runsSHOW TABLESand optimizes every table unconditionally. Theinput_schemahas no properties — it accepts no parameters.Proposed fix
PHP: Add
tablesinput parameterIn the execute callback:
tablesis provided, validate each name exists, then optimize only thosetablesis empty/missing, optimize all (current behavior)JS: Extract table names from user message
The
executefunction should extract table names from the user message and pass them as thetablesparameter. This could be done via:args.tablesif the system prompt describes the parameterwp_*patterns)WooCommerce awareness (#73)
For "optimize the WooCommerce tables", the ability should know which tables belong to WooCommerce. Options:
wp_wc_*,wp_woocommerce_*){prefix}wc_*or{prefix}woocommerce_*Example user queries
wp_optionsFiles to modify
includes/abilities/db-optimize.php— addtablesparam, filter logicsrc/extensions/abilities/db-optimize.js— extract table names or rely on LLM argsRefs
Closes #69, closes #73