The resource instances. * * @since 1.2.0 */ public function resources(): array { $resources = []; $block_types = ( new BlockTypesResource() )->build(); if ( $block_types instanceof McpResource ) { $resources[] = $block_types; } /** * Filters the MCP resources Albert registers. * * Add-ons and themes should **append** their own built McpResource * instances to the provided list (e.g. `$resources[] = $my_resource;`). * The filter is replace-capable (standard WordPress semantics): returning * a list that omits the built-ins will drop them, so always extend the * passed array rather than replacing it. Non-McpResource entries are * dropped. * * @since 1.2.0 * * @param array $resources Built-in resource instances. */ $filtered = apply_filters( 'albert/mcp/resources', $resources ); if ( ! is_array( $filtered ) ) { return $resources; } return array_values( array_filter( $filtered, static function ( $entry ): bool { return $entry instanceof McpResource; } ) ); } }