Skip to main content
Glama

paperpal

by jerpint
MIT License
10
  • Apple
s2.py1.23 kB
import httpx from constants import USER_AGENT async def search_semantic_scholar(query: str, num_papers: int = 20) -> dict: """Search for papers on Semantic Scholar. Args: query (str): The search query num_papers (int): Number of papers to return. Defaults to 20. Returns: dict: The JSON response from Semantic Scholar API containing paper details Raises: httpx.HTTPError: If the API request fails """ fields = "title,authors,url,abstract,tldr,citationStyles" try: async with httpx.AsyncClient() as client: response = await client.get( "https://api.semanticscholar.org/graph/v1/paper/search", params={ "query": query, "limit": num_papers, "fields": fields }, headers={"User-Agent": USER_AGENT} ) response.raise_for_status() return response.json() except httpx.HTTPError as e: raise httpx.HTTPError(f"Failed to fetch papers from Semantic Scholar: {str(e)}") except Exception as e: raise Exception(f"Unexpected error while searching Semantic Scholar: {str(e)}")

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jerpint/paperpal'

If you have feedback or need assistance with the MCP directory API, please join our Discord server