---
name: omni-detail
description: Extract full metadata for a single library record from OCUL Omni (Primo). Use this when the user wants detailed information about a specific item including abstract, subjects, publisher, ISBN, availability, and full-text links. Requires a record ID or detail page URL from omni-search results.
---

# Omni Detail

Extract full metadata from a Primo full-display page. Requires the browser to navigate to the item's detail page.

## Steps

### Step 1: Navigate to Detail Page

If given a `recordId` (e.g. `alma993957563805151`), build the URL:

```
https://ocul-lhd.primo.exlibrisgroup.com/discovery/fulldisplay?docid={RECORD_ID}&context=L&vid=01OCUL_LHD:LHD_DEFAULT&lang=en
```

If given a direct link from search results, navigate to that link directly.

### Step 2: Extract Full Metadata

Wait for the page to load, then run:

```javascript
async () => {
  await new Promise(resolve => setTimeout(resolve, 3000));

  const getText = (selector) =>
    document.querySelector(selector)?.textContent?.trim() || '';

  const getAll = (selector) =>
    Array.from(document.querySelectorAll(selector))
      .map(el => el.textContent.trim())
      .filter(Boolean);

  // Title
  const title = getText('h1.item-title, prm-full-view h1, .full-view-inner-container h1')
    || getText('h1');

  // All labeled metadata fields (label: value pairs)
  const metadataFields = {};
  document.querySelectorAll('prm-full-view-service-container').forEach(section => {
    const label = section.querySelector('span.bold, label')?.textContent?.trim();
    const value = section.querySelector('span:not(.bold)')?.textContent?.trim();
    if (label && value) metadataFields[label] = value;
  });

  // Authors
  const authors = getAll('prm-search-highlight-titles-directive span[dir], .creator a');

  // Abstract
  const abstract = getText('prm-highlight .abstract-text, [class*="abstract"] span, .abstract');

  // Subjects
  const subjects = getAll('prm-search-highlight-titles-directive a[href*="subject"]');

  // Full-text / online access links
  const fulltextLinks = Array.from(
    document.querySelectorAll('prm-full-view-service-container a[href], .getit-link a')
  ).map(a => ({ label: a.textContent.trim(), href: a.href }))
    .filter(l => l.label && l.href && !l.href.includes('javascript'));

  // Availability / location
  const availability = getAll('.location-row, .item-availability, prm-location-items-after-label');

  return {
    status: 'ok',
    title,
    authors,
    abstract: abstract || '(not available)',
    subjects,
    metadata: metadataFields,
    fulltextLinks,
    availability
  };
}
```

### Step 3: Present Results

```
## {title}

**Authors:** {authors}

**Abstract:** {abstract}

**Subjects:** {subjects}

**Metadata:**
{metadata key-value pairs}

**Full-text / Access Links:**
- {label}: {href}

**Availability:**
{availability}
```

## Notes

- `prm-full-view-service-container` elements each represent one metadata section in Primo
- If `abstract` is empty, the record may be a book without an abstract in the catalog
- Full-text links may require institutional login; the browser session handles this automatically
- If the page shows "Sign in required", the browser is not logged in — ask user to log in first

