tooluniverse.europe_pmc_tool 模块¶
- tooluniverse.europe_pmc_tool._normalize_pmcid(pmcid)[源代码]¶
Return (pmcid_norm, pmcid_digits).
pmcid_norm: “PMC123” form (or None) pmcid_digits: “123” digits only (or None)
- tooluniverse.europe_pmc_tool._extract_text_from_html(html_text)[源代码]¶
Best-effort HTML -> text extraction.
For PMC pages, try to restrict to the main content region to avoid nav/JS/CSS noise.
- tooluniverse.europe_pmc_tool._detect_ncbi_oai_error(xml_text)[源代码]¶
- NCBI PMC OAI-PMH often returns HTTP 200 even for logical errors, e.g.:
<error code=”cannotDisseminateFormat”>…</error>
Returns a small structured dict when an error is detected, else None.
- tooluniverse.europe_pmc_tool._fetch_fulltext_with_trace(session, *, europe_fulltext_xml_url, pmcid, timeout=20)[源代码]¶
Fetch full text content with a trace of attempts.
- class tooluniverse.europe_pmc_tool.EuropePMCTool[源代码]¶
基类:
BaseTool用于在 Europe PMC 上搜索文章及其摘要的工具。
- run(arguments)[源代码]¶
执行该工具。
默认的 BaseTool 实现接受一个可选的参数映射,以符合大多数具体工具实现中期望的输入字典。
- 参数:
arguments (
dict, optional) – 工具专用参数stream_callback (
callable, optional) – 用于流式响应的回调use_cache (
bool, optional) – 是否启用了结果缓存validate (
bool, optional) – 是否已执行参数验证
备注
这些附加参数(stream_callback、use_cache、validate)由 run_one_function() 传递,用于提供有关执行的上下文。工具可以利用这些参数进行优化或特殊处理。
为了向后兼容,不接受这些参数的工具仍然可以正常工作——它们只会接收到 arguments 参数。
- class tooluniverse.europe_pmc_tool.EuropePMCFullTextSnippetsTool[源代码]¶
基类:
BaseToolFetch Europe PMC fullTextXML (open access) and return bounded text snippets around user-provided terms. This helps answer questions where the crucial detail is present in the full text (e.g., methods/section titles) but not necessarily in the abstract.
- run(arguments)[源代码]¶
执行该工具。
默认的 BaseTool 实现接受一个可选的参数映射,以符合大多数具体工具实现中期望的输入字典。
- 参数:
arguments (
dict, optional) – 工具专用参数stream_callback (
callable, optional) – 用于流式响应的回调use_cache (
bool, optional) – 是否启用了结果缓存validate (
bool, optional) – 是否已执行参数验证
备注
这些附加参数(stream_callback、use_cache、validate)由 run_one_function() 传递,用于提供有关执行的上下文。工具可以利用这些参数进行优化或特殊处理。
为了向后兼容,不接受这些参数的工具仍然可以正常工作——它们只会接收到 arguments 参数。
- class tooluniverse.europe_pmc_tool.EuropePMCFullTextFetchTool[源代码]¶
基类:
BaseToolFetch full text content for a PMC article with deterministic fallbacks and machine-readable provenance (retrieval_trace).
This tool is intended for machine consumption: it always returns a structured status payload and, when successful, includes source/format/content_type.
- run(arguments)[源代码]¶
执行该工具。
默认的 BaseTool 实现接受一个可选的参数映射,以符合大多数具体工具实现中期望的输入字典。
- 参数:
arguments (
dict, optional) – 工具专用参数stream_callback (
callable, optional) – 用于流式响应的回调use_cache (
bool, optional) – 是否启用了结果缓存validate (
bool, optional) – 是否已执行参数验证
备注
这些附加参数(stream_callback、use_cache、validate)由 run_one_function() 传递,用于提供有关执行的上下文。工具可以利用这些参数进行优化或特殊处理。
为了向后兼容,不接受这些参数的工具仍然可以正常工作——它们只会接收到 arguments 参数。
- class tooluniverse.europe_pmc_tool.EuropePMCRESTTool[源代码]¶
基类:
BaseToolGeneric REST tool for Europe PMC API endpoints. Supports citations, references, and other article-related endpoints.
- class tooluniverse.europe_pmc_tool.EuropePMCStructuredFullTextTool[源代码]¶
基类:
BaseToolRetrieve and parse full-text XML from Europe PMC into structured sections (title, abstract, introduction, methods, results, discussion, figures, tables, references). Accepts a PMC ID or PMID (auto-resolved via the Europe PMC search API).
- _SECTION_KEYWORDS: dict[str, list[str]] = {'acknowledgments': ['acknowledgments', 'acknowledgements', 'funding'], 'conclusions': ['conclusions', 'conclusion', 'summary'], 'discussion': ['discussion'], 'introduction': ['introduction', 'background', 'intro'], 'methods': ['methods', 'materials and methods', 'material and methods', 'methodology', 'experimental', 'experimental procedures', 'study design', 'patients and methods'], 'results': ['results', 'findings']}¶
- run(arguments)[源代码]¶
执行该工具。
默认的 BaseTool 实现接受一个可选的参数映射,以符合大多数具体工具实现中期望的输入字典。
- 参数:
arguments (
dict, optional) – 工具专用参数stream_callback (
callable, optional) – 用于流式响应的回调use_cache (
bool, optional) – 是否启用了结果缓存validate (
bool, optional) – 是否已执行参数验证
备注
这些附加参数(stream_callback、use_cache、validate)由 run_one_function() 传递,用于提供有关执行的上下文。工具可以利用这些参数进行优化或特殊处理。
为了向后兼容,不接受这些参数的工具仍然可以正常工作——它们只会接收到 arguments 参数。