semantic_scholar_search.cpython-310.pyc•2.56 kB
o
Ar�g� � @ s� d dl Zd dl mZmZmZ d dlmZmZmZ defdd�Z dded e
d
edeee
ef fdd�Zded
e
defdd�Z
dede
defdd�Zdedee
eee
ef f fdd�Zdd� Zedkrie� dS dS )� N)�SemanticScholar�Author�Paper)�List�Dict�Any�returnc C s t � S )z&Initialize the SemanticScholar client.N)r � r r �N/home/zjlab/code/mcp_hub/semanticscholar-MCP-Server/semantic_scholar_search.py�initialize_client s r �
�client�query�limitc C s | j ||d�}dd� |D �S )z'Search for papers using a query string.)r c S s@ g | ]}|j |j|j|jd d� |jD �|j|j|j|jd� �qS )c S s g | ] }|j |jd ��qS )��name�authorIdr )�.0�authorr r r
�
<listcomp> s z,search_papers.<locals>.<listcomp>.<listcomp>� �paperId�title�abstract�year�authors�url�venue�publicationTypes�
citationCountr )r �paperr r r
r s ���z!search_papers.<locals>.<listcomp>N)�search_paper)r
r r �resultsr r r
�
search_papers s �r# �paper_idc C �
| � |�S )z Get details of a specific paper.N)� get_paper)r
r$ r r r
�get_paper_details �
r'