Skip to content

Commit ec2e267

Browse files
committed
Remove wp-forge-media-search tool
The search parameter is already supported by wp-forge-media-list, making a dedicated search tool redundant. - Remove media-search ability from MediaTools.php - Update ability/tool count assertions from 53 to 52 - Replace media-search integration test call with media-list - Remove tool from README and expected tool lists
1 parent 36bfcd8 commit ec2e267

4 files changed

Lines changed: 6 additions & 12 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ See [docs/architecture.md](docs/architecture.md) for the ability registry, regis
5252
| `wp-forge-media-upload` | Upload a new media file to WordPress |
5353
| `wp-forge-media-update` | Update a WordPress media item |
5454
| `wp-forge-media-delete` | Delete a WordPress media item permanently |
55-
| `wp-forge-media-search` | Search WordPress media by title, caption, or description |
5655

5756
### Site Management
5857

src/Tools/MediaTools.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,5 @@ private function add_media_abilities() {
7272
$this->add_ability( self::INTERNAL_PREFIX . 'media-delete', 'Delete Media', 'Delete a WordPress media item permanently', $id_schema, function ( $params ) {
7373
return $this->delete_content_item( (int) $params['id'], 'attachment' );
7474
}, false, 'upload_files', array( 'destructive' => true, 'idempotent' => true ), array( $this, 'can_delete_media_request' ) );
75-
$this->add_ability( self::INTERNAL_PREFIX . 'media-search', 'Search Media', 'Search WordPress media by title, caption, or description', $list_schema, function ( $params ) {
76-
return $this->search_content_items( 'attachment', array_merge( array( 'status' => 'inherit' ), $params ) );
77-
}, true, 'upload_files' );
7875
}
7976
}

tests/integration/mcp-endpoint.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ const expectedTools = [
189189
'wp-forge-media-upload',
190190
'wp-forge-media-update',
191191
'wp-forge-media-delete',
192-
'wp-forge-media-search',
193192
'wp-forge-user-search',
194193
'wp-forge-user-get',
195194
'wp-forge-user-save',
@@ -334,7 +333,7 @@ const mediaId = await expectSuccess('wp-forge-media-upload', {
334333
base64: Buffer.from(`MCP media ${suffix}`).toString('base64'),
335334
});
336335
await expectSuccess('wp-forge-media-list', { per_page: 5 });
337-
await expectSuccess('wp-forge-media-search', { search: 'MCP media', per_page: 5 });
336+
await expectSuccess('wp-forge-media-list', { search: 'MCP media', per_page: 5 });
338337
const media = await expectSuccess('wp-forge-media-get', { id: mediaId });
339338
assert(media.id === mediaId, 'wp-forge-media-get returned the wrong item');
340339
const mediaFile = await expectSuccess('wp-forge-media-file-get', { id: mediaId });

tests/run.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ function assert_same( $expected, $actual, $message ) {
351351
$all = $abilities->list_abilities();
352352
$names = array_column( $all, 'name' );
353353

354-
assert_same( 53, count( $all ), 'Expected the WordPress ability catalog.' );
354+
assert_same( 52, count( $all ), 'Expected the WordPress ability catalog.' );
355355
assert_true( in_array( 'wp-forge-content-search', $names, true ), 'Expected content search ability.' );
356356
assert_true( in_array( 'wp-forge-site-info-get', $names, true ), 'Expected site info ability.' );
357357
assert_true( in_array( 'wp-forge-api-function-run', $names, true ), 'Expected REST runner ability.' );
@@ -374,7 +374,6 @@ function assert_same( $expected, $actual, $message ) {
374374
'wp-forge-media-upload',
375375
'wp-forge-media-update',
376376
'wp-forge-media-delete',
377-
'wp-forge-media-search',
378377
'wp-forge-user-search',
379378
'wp-forge-user-get',
380379
'wp-forge-user-save',
@@ -489,7 +488,7 @@ function assert_same( $expected, $actual, $message ) {
489488

490489
$direct_tools = $abilities->list_tools();
491490
$direct_tool_names = array_column( $direct_tools, 'name' );
492-
assert_same( 53, count( $direct_tools ), 'Expected all abilities to be exposed as direct MCP tools.' );
491+
assert_same( 52, count( $direct_tools ), 'Expected all abilities to be exposed as direct MCP tools.' );
493492
assert_true( in_array( 'wp-forge-content-search', $direct_tool_names, true ), 'Direct tool list should include content search.' );
494493
assert_true( in_array( 'wp-forge-theme-active-get', $direct_tool_names, true ), 'Direct tool list should include active theme.' );
495494
assert_true( ! in_array( 'wp-forge-list-abilities', $direct_tool_names, true ), 'Gateway list tool should not be exposed.' );
@@ -571,11 +570,11 @@ function assert_same( $expected, $actual, $message ) {
571570
assert_same( array(), $mcp_api_functions['message'], 'REST function list should not expose the MCP transport route.' );
572571

573572
$wp_ability_names = $abilities->get_wordpress_ability_names();
574-
assert_same( 53, count( $wp_ability_names ), 'Expected all abilities to be available for the MCP adapter.' );
573+
assert_same( 52, count( $wp_ability_names ), 'Expected all abilities to be available for the MCP adapter.' );
575574
assert_true( in_array( 'wp-forge/content-search', $wp_ability_names, true ), 'Adapter ability list should use WordPress ability names.' );
576575

577576
$abilities->register_wordpress_abilities();
578-
assert_same( 53, count( $registered_abilities ), 'Expected every ability to be registered with the WordPress Abilities API.' );
577+
assert_same( 52, count( $registered_abilities ), 'Expected every ability to be registered with the WordPress Abilities API.' );
579578
assert_true( isset( $registered_abilities['wp-forge/content-search'] ), 'Content search should be registered with the WordPress Abilities API.' );
580579
assert_same( 'Search and filter content for any registered post type', $registered_abilities['wp-forge/content-search']['description'], 'Registered ability should preserve descriptions.' );
581580
assert_same( true, $registered_abilities['wp-forge/content-search']['meta']['show_in_rest'], 'Registered abilities should be exposed through the Abilities REST API.' );
@@ -622,7 +621,7 @@ public function create_server() {
622621
assert_same( 'mcp', $adapter->args[1], 'Adapter server should keep the existing REST namespace.' );
623622
assert_same( 'wp-forge', $adapter->args[2], 'Adapter server should keep the existing REST route.' );
624623
assert_same( 'WordPress MCP', $adapter->args[3], 'Adapter server should preserve the server name.' );
625-
assert_same( 53, count( $adapter->args[9] ), 'Adapter server should expose every registered ability.' );
624+
assert_same( 52, count( $adapter->args[9] ), 'Adapter server should expose every registered ability.' );
626625
assert_true( in_array( 'wp-forge/content-search', $adapter->args[9], true ), 'Adapter server should expose content search.' );
627626

628627
echo 'Tests passed: ' . $tests_run . PHP_EOL;

0 commit comments

Comments
 (0)