Files
WP-LIT-MCP/src/Integrations/Media/MediaIntegration.php
T
janniclas.loosenandClaude Opus 5.5 931ddeb137 feat: batch media metadata updates and delete with usage check
lit/media-update validates the whole batch first (edit_post, lengths, optional
modified lock) and restores already written items when a write fails midway.
lit/media-delete requires confirm, refuses used media without force and
reports refused deletes as write_failed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
2026-09-26 02:49:41 +02:00

51 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace LIT\MCP\Integrations\Media;
use LIT\MCP\ChangeLog\ChangeLog;
use LIT\MCP\Integrations\Integration;
use LIT\MCP\Integrations\WordPress\Schema\ContentSchema;
use LIT\MCP\Limits;
/**
* Media library tools (spec §6.3). Always available. $log and $limits serve the write
* tools (upload, update, delete).
*/
final class MediaIntegration implements Integration
{
public function __construct(private ContentSchema $schema, private ChangeLog $log, private Limits $limits)
{
}
public function id(): string
{
return 'media';
}
public function isAvailable(): bool
{
return true;
}
public function abilities(): array
{
$presenter = new MediaPresenter();
$finder = new MediaUsageFinder(fn (): array => $this->schema->mediaFieldKeys());
$importer = new MediaImporter($this->limits);
$uploads = new MediaUploads($presenter, $this->log, $this->schema);
return [
new MediaSearchAbility($presenter, $finder),
new MediaGetAbility($presenter, $finder),
new MediaPreviewAbility(),
new MediaUploadFromUrlAbility($importer, $uploads),
new MediaUploadAbility($importer, $uploads, $this->limits),
new MediaDownloadAbility($this->limits),
new MediaUpdateAbility($this->log),
new MediaDeleteAbility($finder, $this->log),
];
}
}