Coding standards
Security in ResourceSpace
Developer reference
- Project structure
- Database schema
- Fixed list fields
- Debugging ResourceSpace
- Writing your own plugins
- Context help links
- Custom fields ("user" defined)
- Query caching
- All user permissions
- Client side API calls
- Modals
- Sending user notifications
- Progressive Web App
- Managing (PHP) code dependencies
- Managing (JS) code dependencies
- OpenAPI documentation
- Automated Testing
Database
- Table: activity_log
- Table: annotation
- Table: annotation_node
- Table: api_log
- Table: collection
- Table: collection_keyword
- Table: collection_log
- Table: collection_resource
- Table: collection_savedsearch
- Table: comment
- Table: daily_stat
- Table: dash_tile
- Table: dynamic_tree_node
- Table: error_log
- Table: external_access_keys
- Table: filter
- Table: filter_rule
- Table: filter_rule_node
- Table: ip_lockout
- Table: job_queue
- Table: keyword
- Table: keyword_related
- Table: mail_log
- Table: message
- Table: node
- Table: node_keyword
- Table: plugins
- Table: preview_size
- Table: report
- Table: report_periodic_emails
- Table: report_periodic_emails_unsubscribe
- Table: request
- Table: research_request
- Table: resource
- Table: resource_alt_files
- Table: resource_custom_access
- Table: resource_dimensions
- Table: resource_keyword
- Table: resource_log
- Table: resource_node
- Table: resource_related
- Table: resource_type
- Table: resource_type_field
- Table: resource_type_field_resource_type
- Table: search_log
- Table: site_text
- Table: slideshow
- Table: sysvars
- Table: tab
- Table: user
- Table: user_api_session_code
- Table: user_collection
- Table: user_dash_tile
- Table: user_message
- Table: user_preferences
- Table: user_rating
- Table: user_userlist
- Table: user_report
- Table: usergroup
- Table: usergroup_collection
- Table: usergroup_dash_tile
Mcp browse functions
Mcp report functions
Mcp management functions
mcp_similar_resources()
Description
Retrieve a permission-filtered page of similar resources without triggering recognition or generating embeddings.Parameters
| Column | Type | Default | Description |
|---|---|---|---|
| $args: | array | mcp_visible_resource$args['ref']; if !checkperm's' | |
| $args | array | Validated tool arguments. |
Return
| array | Structured MCP result or permission/availability error. |
Location
include/mcp_management_functions.php lines 708 to 748
Definition
function mcp_similar_resources(array $args): array
{
$source = mcp_visible_resource($args['ref']);
if (!checkperm('s')) {
return mcp_error_result('Search permission required.', 'permission_denied');
}
$mode = $args['similarity'] ?? 'visual';
if ($mode === 'same_named_person') {
$field = (int) ($GLOBALS['faces_tag_field'] ?? 0);
if (
!in_array('faces', $GLOBALS['plugins'], true) || checkperm('faces-v')
|| !$field || !isset(mcp_search_fields((int) $source['resource_type'])[$field])
) {
return mcp_error_result('Named-person search unavailable.', 'feature_unavailable');
}
mcp_check_search_source('!hasdata' . $field);
$nodes = get_resource_nodes($args['ref'], $field);
if (!$nodes) {
return mcp_list_page('rows', [], $args);
}
if (count($nodes) > 25) {
throw new DomainException('This asset has too many named people. Search one visible name instead.');
}
$query = implode('', array_map(static fn($id) => NODE_TOKEN_PREFIX . $id, $nodes));
mcp_check_search_source($query);
$matches = mcp_search(['query' => $query, 'offset' => $args['offset'] ?? 0, 'limit' => $args['limit'] ?? 25]);
return mcp_result(['rows' => $matches['structuredContent']['resources'], 'total' => $matches['structuredContent']['total'],
'basis' => 'recorded_person_tags']);
}
if (!in_array('clip', $GLOBALS['plugins'], true) || checkperm('clip-v')) {
return mcp_error_result('Stored visual similarity search unavailable.', 'feature_unavailable');
}
require_once dirname(__DIR__) . '/plugins/clip/include/clip_functions.php';
$limit = min(100, max(1, (int) $GLOBALS['clip_results_limit_similar']));
$matches = clip_stored_image_matches($args['ref'], $limit);
if ($matches === null) {
return mcp_error_result('A stored vector or its search service is unavailable.', 'index_unavailable');
}
$cutoff = $mode === 'near_duplicate' ? $GLOBALS['clip_duplicate_cutoff'] : $GLOBALS['clip_similar_cutoff'];
return mcp_visible_vector_matches($matches, $args, $cutoff, $limit);
}
This article was last updated 4th December 2026 11:35 Europe/London time based on the source file dated 4th December 2026 09:40 Europe/London time.