Semanticscholar

Learn how to use Semanticscholar with Composio

Overview

SLUG: SEMANTICSCHOLAR

Description

Semantic Scholar is an AI-powered academic search engine that helps researchers discover and understand scientific literature

Authentication Details

generic_api_key
stringRequired

Connecting to Semanticscholar

Create an auth config

Use the dashboard to create an auth config for the Semanticscholar toolkit. This allows you to connect multiple Semanticscholar accounts to Composio for agents to use.

1

Select App

Navigate to Semanticscholar.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Semanticscholar Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4semanticscholar_auth_config_id = "ac_YOUR_SEMANTICSCHOLAR_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": user_api_key}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Semanticscholar for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, semanticscholar_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Semanticscholar toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["SEMANTICSCHOLAR"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Details about an author

Description

Examples: <ul> <li><code>https://api.semanticscholar.org/graph/v1/author/1741101</code></li> <ul> <li>returns the author's authorid and name.</li> </ul> <li><code>https://api.semanticscholar.org/graph/v1/author/1741101?fields=url,papers</code></li> <ul> <li>returns the author's authorid, url, and list of papers. </li> <li>each paper has its paperid plus its title.</li> </ul> <li><code>https://api.semanticscholar.org/graph/v1/author/1741101?fields=url,papers.abstract,papers.authors</code></li> <ul> <li>returns the author's authorid, url, and list of papers. </li> <li>each paper has its paperid, abstract, and list of authors.</li> <li>in that list of authors, each author has their authorid and name.</li> </ul> <br /> limitations: <ul> <li>can only return up to 10 mb of data at a time.</li> </ul> </ul>

Action Parameters

author_id
stringRequired
fields
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Details about an author s papers

Description

Retrieves a list of papers authored by a specific researcher identified by their unique semantic scholar author id. this endpoint is particularly useful for conducting literature reviews, analyzing an author's body of work, or tracking a researcher's publications over time. it provides a comprehensive view of an author's contributions to their field of study. the endpoint returns only the papers associated with the specified author and does not include co-authored works where the specified author is not listed as a primary author. note that the response may be paginated for authors with a large number of publications, and additional api calls might be necessary to retrieve the complete list of papers.

Action Parameters

author_id
stringRequired
fields
string
limit
integerDefaults to 100
offset
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Details about a paper

Description

Examples: <ul> <li><code>https://api.semanticscholar.org/graph/v1/paper/649def34f8be52c8b66281af98ae884c09aef38b</code></li> <ul> <li>returns a paper with its paperid and title. </li> </ul> <li><code>https://api.semanticscholar.org/graph/v1/paper/649def34f8be52c8b66281af98ae884c09aef38b?fields=url,year,authors</code></li> <ul> <li>returns the paper's paperid, url, year, and list of authors. </li> <li>each author has authorid and name.</li> </ul> <li><code>https://api.semanticscholar.org/graph/v1/paper/649def34f8be52c8b66281af98ae884c09aef38b?fields=citations.authors</code></li> <ul> <li>returns the paper's paperid and list of citations. </li> <li>each citation has its paperid plus its list of authors.</li> <li>each author has their 2 always included fields of authorid and name.</li> </ul> <br /> limitations: <ul> <li>can only return up to 10 mb of data at a time.</li> </ul> </ul>

Action Parameters

fields
string
paper_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Details about a paper s authors

Description

Retrieves the list of authors for a specific paper identified by its unique paper id in the semantic scholar database. this endpoint is useful when you need detailed information about the contributors to a particular academic publication. it provides access to the author data associated with the paper, which may include names, affiliations, and potentially other metadata. this tool should be used when users require author information for a known paper, such as when exploring collaborations or tracking an author's body of work. it does not provide the full paper content or other paper metadata beyond author information.

Action Parameters

fields
string
limit
integerDefaults to 100
offset
integer
paper_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Details about a paper s citations

Description

Retrieves a list of citations for a specific academic paper using its unique semantic scholar paper id. this endpoint is useful for researchers and developers who want to explore the impact and connections of a particular academic work within the broader scientific literature. it provides information about other papers that have cited the specified paper, allowing users to trace the influence of research and discover related works. the endpoint should be used when analyzing the reception and impact of a specific paper, building citation networks, or conducting bibliometric studies. it does not provide the full text of citing papers or detailed information about the citations beyond basic metadata.

Action Parameters

fields
string
limit
integerDefaults to 100
offset
integer
paper_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Details about a paper s references

Description

Retrieves the list of references cited by a specific paper in the semantic scholar database. this endpoint allows users to explore the scholarly context of a publication by accessing its bibliography. it's particularly useful for understanding the foundation of a paper's research, tracing the development of ideas, or conducting literature reviews. the tool returns details about the cited papers, which may include their titles, authors, publication dates, and semantic scholar ids. it should be used when analyzing a paper's sources or investigating the connections between different academic works. note that this endpoint only provides outgoing references (papers cited by the specified paper) and not incoming citations (papers that cite the specified paper).

Action Parameters

fields
string
limit
integerDefaults to 100
offset
integer
paper_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get details for multiple authors at once

Description

Retrieves detailed information for multiple authors from semantic scholar in a single api call. this endpoint allows users to efficiently fetch data for a batch of authors by providing their unique semantic scholar ids. it's particularly useful for applications that need to gather information on multiple authors simultaneously, reducing the number of individual api calls required. the endpoint accepts a list of author ids and returns comprehensive details for each author, which may include their publications, citations, and other relevant academic information. while the exact response structure is not specified in the given schema, users can expect rich metadata about the requested authors.

Action Parameters

fields
string
ids
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get details for multiple papers at once

Description

The semanticscholar paper batch endpoint allows users to retrieve data for multiple academic papers in a single api call. this endpoint is particularly useful when you need to fetch information for a batch of papers efficiently, reducing the number of individual api requests. it accepts an array of paper ids and returns the corresponding data for each paper. use this endpoint when you have a list of known paper ids and want to retrieve their details simultaneously. keep in mind that while there's no specified limit on the number of ids you can send, very large batches may be subject to api rate limiting or response size restrictions.

Action Parameters

fields
string
ids
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Search for authors by name

Description

The authorsearch endpoint allows users to search for authors within the semantic scholar database. it provides a way to find academic authors based on their names or other identifying information. this endpoint is particularly useful when you need to retrieve author metadata, such as their publications, affiliations, or research areas. the search functionality supports partial name matches and is case-insensitive, making it flexible for various search scenarios. use this endpoint when you want to discover authors or verify author information in the context of academic research. note that the search results may be limited and paginated, so multiple requests might be necessary for comprehensive results.

Action Parameters

fields
string
limit
integerDefaults to 100
offset
integer
query
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Suggest paper query completions

Description

To support interactive query-completion, return minimal information about papers matching a partial query example: <code>https://api.semanticscholar.org/graph/v1/paper/autocomplete?query=semanti</code>

Action Parameters

query
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired