tooluniverse.europe_pmc_tool module¶
- tooluniverse.europe_pmc_tool._normalize_pmcid(pmcid)[source]¶
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)[source]¶
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)[source]¶
- 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)[source]¶
Fetch full text content with a trace of attempts.
- class tooluniverse.europe_pmc_tool.EuropePMCTool[source]¶
Bases:
BaseToolTool to search for articles on Europe PMC including abstracts.
- run(arguments)[source]¶
Execute the tool.
The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.
- Parameters:
arguments (
dict, optional) – Tool-specific argumentsstream_callback (
callable, optional) – Callback for streaming responsesuse_cache (
bool, optional) – Whether result caching is enabledvalidate (
bool, optional) – Whether parameter validation was performed
Note
These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.
For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.
- class tooluniverse.europe_pmc_tool.EuropePMCFullTextSnippetsTool[source]¶
Bases:
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)[source]¶
Execute the tool.
The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.
- Parameters:
arguments (
dict, optional) – Tool-specific argumentsstream_callback (
callable, optional) – Callback for streaming responsesuse_cache (
bool, optional) – Whether result caching is enabledvalidate (
bool, optional) – Whether parameter validation was performed
Note
These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.
For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.
- class tooluniverse.europe_pmc_tool.EuropePMCFullTextFetchTool[source]¶
Bases:
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)[source]¶
Execute the tool.
The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.
- Parameters:
arguments (
dict, optional) – Tool-specific argumentsstream_callback (
callable, optional) – Callback for streaming responsesuse_cache (
bool, optional) – Whether result caching is enabledvalidate (
bool, optional) – Whether parameter validation was performed
Note
These additional parameters (stream_callback, use_cache, validate) are passed from run_one_function() to provide context about the execution. Tools can use these for optimization or special handling.
For backward compatibility, tools that don’t accept these parameters will still work - they will only receive the arguments parameter.