UNPKG

@cyanheads/pubmed-mcp-server

Version:

Search PubMed/Europe PMC, fetch articles and full text (PMC/EPMC/Unpaywall), citations, MeSH terms via MCP. STDIO or Streamable HTTP.

30 lines 1.88 kB
/** * @fileoverview Parser for PMC full-text articles in JATS XML format. * Consumes the ordered tree shape from fast-xml-parser's `preserveOrder: true` * mode (see `pmc-xml-helpers.ts`) so that mixed-content elements — `<p>`, * `<abstract>`, `<title>` with inline `<italic>`, `<xref>`, `<sup>`, etc. — * read back in document order. Parsing in the default object shape scrambles * inline children and drops body sections for markup-heavy articles. * @module src/services/ncbi/parsing/pmc-article-parser */ import type { ParsedPmcArticle, ParsedPmcAuthor, ParsedPmcReference, ParsedPmcSection } from '../types.js'; import { type JatsNode } from './pmc-xml-helpers.js'; /** Extract authors from a single `<contrib-group>` node. Non-author contributors are skipped. */ export declare function extractJatsAuthors(contribGroup: JatsNode | undefined): ParsedPmcAuthor[]; /** * Extract body sections from a `<body>` node, walking children in document order. * Consecutive bare `<p>` siblings are collected into an untitled section so * articles with mixed structure (direct paragraphs + trailing `<sec>`, common * in manuscript-submitted PMC deposits) preserve their main text. */ export declare function extractBodySections(body: JatsNode | undefined): ParsedPmcSection[]; /** Extract references from a `<back>` node. Prefers mixed-citation over element-citation. */ export declare function extractReferences(back: JatsNode | undefined): ParsedPmcReference[]; /** * Parse a single JATS `<article>` node (from PMC EFetch via the ordered parser) * into a structured `ParsedPmcArticle`. The input node is the element wrapper * itself — `{ article: [...], ':@': { '@_article-type': ... } }` — not the * outer `<pmc-articleset>`. */ export declare function parsePmcArticle(articleNode: JatsNode): ParsedPmcArticle; //# sourceMappingURL=pmc-article-parser.d.ts.map