tooluniverse.semantic_scholar_tool module

class tooluniverse.semantic_scholar_tool.SemanticScholarTool[source]

Bases: BaseTool

Tool to search for papers on Semantic Scholar including abstracts.

API key is read from environment variable SEMANTIC_SCHOLAR_API_KEY. Request an API key at: https://www.semanticscholar.org/product/api

Rate limits: - Without API key: 1 request/second - With API key: 100 requests/second

_last_request_time = 0.0
_rate_limit_lock = <unlocked _thread.lock object>
__init__(tool_config, base_url='https://api.semanticscholar.org/graph/v1/paper/search')[source]
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 arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (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.

_enforce_rate_limit(has_api_key)[source]
_fetch_missing_abstract(paper_id)[source]
class tooluniverse.semantic_scholar_tool.SemanticScholarPDFSnippetsTool[source]

Bases: BaseTool

Fetch a paper’s PDF from Semantic Scholar and return bounded text snippets around user-provided terms. Uses markitdown to convert PDF to markdown text.

__init__(tool_config)[source]
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 arguments

  • stream_callback (callable, optional) – Callback for streaming responses

  • use_cache (bool, optional) – Whether result caching is enabled

  • validate (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.