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_share_inventory()
Description
Summarise recorded shares. Bearer keys are used only to derive an opaque management identifier on the server.Parameters
| Column | Type | Default | Description |
|---|---|---|---|
| $args: | array | ||
| $args | array | Validated tool arguments. |
Return
| array | Structured MCP result or permission/availability error. |
Location
include/mcp_management_functions.php lines 290 to 338
Definition
function mcp_share_inventory(array $args): array
{
$filters = ['share_type' => 0];
if (!checkperm('a')) {
$filters['share_user'] = $GLOBALS['userref'];
if (!isset($args['ref']) && !isset($args['collection'])) {
return mcp_error_result('Select an accessible resource or collection for your own shares.', 'scope_required');
}
}
if (isset($args['ref'])) {
mcp_visible_resource($args['ref']);
$filters['share_resource'] = $args['ref'];
}
if (isset($args['collection'])) {
if (checkperm('b') || !collection_readable($args['collection'])) {
throw new DomainException('Collection unavailable.');
}
$filters['share_collection'] = $args['collection'];
}
$shares = get_external_shares($filters, true);
$range = mcp_event_dates($args, 'expires');
$sql = "SELECT access_key, user AS creator, resource, collection, date, expires, access, lastused FROM ({$shares->sql}) shares WHERE {$range->sql}";
if (isset($args['status'])) {
$sql .= $args['status'] === 'active' ? ' AND (expires IS NULL OR expires >= NOW())' : ' AND expires < NOW()';
}
$rows = sql_limit_with_total_count(new PreparedStatementQuery(
$sql . ' ORDER BY date DESC, access_key',
array_merge($shares->parameters, $range->parameters)
), $args['limit'] ?? 25, $args['offset'] ?? 0);
foreach ($rows['data'] as &$row) {
if (!empty($GLOBALS['scramble_key'])) {
$row['share_reference'] = hash_hmac('sha256', 'mcp-share:' . $row['access_key'], $GLOBALS['scramble_key']);
}
unset($row['access_key']);
if (!is_positive_int_loose($row['collection']) || checkperm('b') || !collection_readable((int) $row['collection'])) {
unset($row['collection']);
}
if (is_positive_int_loose($row['resource'])) {
try {
mcp_visible_resource((int) $row['resource']);
} catch (DomainException $error) {
unset($row['resource']);
}
} else {
unset($row['resource']);
}
}
return mcp_result(['total' => $rows['total'], 'rows' => $rows['data']]);
}
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.