Skip to main content
Glama
smaniches

Semantic Scholar MCP Server

by smaniches

semantic_scholar_recommendations

Find relevant academic papers by providing a seed paper ID. This tool analyzes research connections to suggest related publications for literature review and discovery.

Instructions

Get paper recommendations based on a seed paper.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function implementing the semantic_scholar_recommendations tool. Calls Semantic Scholar's recommendations API using the provided paper_id as seed, retrieves recommended papers, and formats output in Markdown or JSON.
    @mcp.tool(name="semantic_scholar_recommendations")
    async def get_recommendations(params: PaperRecommendationsInput) -> str:
        """Get paper recommendations based on a seed paper."""
        logger.info(f"Recommendations for: {params.paper_id}")
    
        async with httpx.AsyncClient(timeout=DEFAULT_TIMEOUT) as client:
            resp = await client.post(
                f"https://api.semanticscholar.org/recommendations/v1/papers/forpaper/{params.paper_id}",
                params={"fields": ",".join(PAPER_FIELDS), "limit": params.limit},
                json={"positivePaperIds": [params.paper_id]},
                headers=_get_headers()
            )
            resp.raise_for_status()
            data = resp.json()
        
        papers = data.get("recommendedPapers", [])
        
        if params.response_format == ResponseFormat.JSON:
            return json.dumps({"seed": params.paper_id, "recommendations": papers}, indent=2)
        
        lines = [f"## Recommendations", f"**Seed:** {params.paper_id}", f"**Found:** {len(papers)}", ""]
        for paper in papers:
            lines.append(_format_paper_markdown(paper))
        return "\n".join(lines)
  • Pydantic input schema defining parameters for the semantic_scholar_recommendations tool: seed paper_id, number of recommendations, and output format.
    class PaperRecommendationsInput(BaseModel):
        model_config = ConfigDict(str_strip_whitespace=True, extra="forbid")
        paper_id: str = Field(..., description="Seed paper ID for recommendations", min_length=1)
        limit: int = Field(default=10, description="Max recommendations", ge=1, le=100)
        response_format: ResponseFormat = Field(default=ResponseFormat.MARKDOWN, description="Output format")
  • Helper function to format individual paper data into Markdown, used in the tool's output rendering.
    def _format_paper_markdown(paper: Dict[str, Any]) -> str:
        lines = []
        title = paper.get("title", "Unknown Title")
        year = paper.get("year", "N/A")
        lines.append(f"### {title} ({year})")
        
        authors = paper.get("authors", [])
        if authors:
            names = [a.get("name", "?") for a in authors[:5]]
            if len(authors) > 5:
                names.append(f"... +{len(authors)-5} more")
            lines.append(f"**Authors:** {', '.join(names)}")
        
        venue = paper.get("venue") or (paper.get("publicationVenue") or {}).get("name")
        if venue:
            lines.append(f"**Venue:** {venue}")
        
        citations = paper.get("citationCount", 0)
        influential = paper.get("influentialCitationCount", 0)
        lines.append(f"**Citations:** {citations} ({influential} influential)")
        
        pdf_info = paper.get("openAccessPdf") or {}
        if pdf_info.get("url"):
            lines.append(f"**Open Access:** [PDF]({pdf_info['url']})")
    
        fields = paper.get("fieldsOfStudy") or []
        if fields:
            lines.append(f"**Fields:** {', '.join(fields[:5])}")
        
        tldr = paper.get("tldr") or {}
        if tldr.get("text"):
            lines.append(f"**TL;DR:** {tldr['text']}")
        
        abstract = paper.get("abstract")
        if abstract:
            lines.append(f"**Abstract:** {abstract[:500]}..." if len(abstract) > 500 else f"**Abstract:** {abstract}")
        
        ext_ids = paper.get("externalIds") or {}
        ids = []
        if ext_ids.get("DOI"): ids.append(f"DOI: {ext_ids['DOI']}")
        if ext_ids.get("ArXiv"): ids.append(f"ArXiv: {ext_ids['ArXiv']}")
        if ext_ids.get("PubMed"): ids.append(f"PMID: {ext_ids['PubMed']}")
        if ids:
            lines.append(f"**IDs:** {', '.join(ids)}")
        
        if paper.get("url"):
            lines.append(f"**Link:** [{paper.get('paperId')}]({paper['url']})")
        
        lines.append("")
        return "\n".join(lines)
  • Helper function providing HTTP headers including optional API key for Semantic Scholar requests.
    def _get_headers() -> Dict[str, str]:
        headers = {"Accept": "application/json", "Content-Type": "application/json"}
        if SEMANTIC_SCHOLAR_API_KEY:
            headers["x-api-key"] = SEMANTIC_SCHOLAR_API_KEY
        return headers
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Get paper recommendations') but doesn't describe traits like rate limits, authentication needs, response structure, or potential errors. For a tool with no annotations, this leaves significant gaps in understanding how it behaves beyond the basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly. Every word earns its place by conveying the core function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values) and no annotations, the description is minimally complete for a simple recommendation tool. However, with 0% schema coverage and no behavioral details, it lacks sufficient context for effective use, such as explaining parameter interactions or error cases, making it adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'based on a seed paper,' which hints at the 'paper_id' parameter but doesn't explain 'limit' or 'response_format.' The description adds minimal meaning beyond the schema, failing to fully address the coverage gap, resulting in a baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('paper recommendations') with the specific condition 'based on a seed paper.' It distinguishes from siblings like search_papers or get_paper by focusing on recommendations rather than direct retrieval or search. However, it doesn't explicitly mention the Semantic Scholar context, which is implied by the tool name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools (e.g., semantic_scholar_search_papers for broader searches) or specify scenarios where recommendations are preferred over direct lookups. Usage is implied by the purpose but lacks explicit context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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/smaniches/semantic-scholar-mcp'

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