Skip to main content

npm SDK Breadcrumbs

Start with getSectionRules when you need to understand how an MRT section was produced. Each rule can include a breadcrumb trace, metadata, and links to the files it used.

Inspect a rule

breadcrumbs is the structured execution trace, when one was recorded. ruleMetadata contains rule-specific information. Either field can be null.

Open a file referenced by a rule

Depending on the rule, the file resource ID may be found in one of these fields:
Pass the returned ID directly to openFile:
Do not use the deprecated templateUrl or presignedUrl compatibility fields as browser URLs. Use the associated resource ID with openFile instead.

Fetch and summarize all rules

This helper is useful when building a rules panel or logging the result of a section run. It surfaces the rule type, confidence, resource IDs, breadcrumb stages, and metadata without requiring a separate request for each rule.

Build a React rules inspector

The following is a starting point for a panel that lets a user expand a rule and inspect its generated content, sources, table data, breadcrumbs, and metadata. The styling is intentionally left to the application.
The object has a stable top-level shape. Some stages are omitted when they do not apply to a rule.
The four stage keys describe different parts of the pipeline:
  1. generation explains why the rule was selected, including search evidence, selection rationale, missing-content notes, and expansion reasoning.
  2. execution_pre_postprocessing records status, duration, iterations, input/output sizes, execution steps, errors, and missing data.
  3. postprocessing records whether cleanup changed the content and why.
  4. style_guide_text records style-guide decisions, references, and changes.

Render a breadcrumb audit trail

This component turns the trace into a compact summary with expandable stages. The exact CSS is application-specific, but the data handling can look like this:

Rule metadata by type

Metadata varies by rule type. These are representative shapes; applications should treat unknown fields as optional.

template_text

template_table

Extraction and intra-document summary rules

When rendering table_structure_html, sanitize it before inserting it into the DOM. Treat it as untrusted HTML even when it came from your own document.

Walk through every section

For a document-level rules view, first list the sections and then fetch the rules for each section. This gives the UI enough context to render navigation, rule details, and breadcrumb warnings together.

Filter rules by type

Different rule types usually deserve different UI treatments: