semantic_scholar_get_author
Retrieve author profiles and publications from Semantic Scholar's academic database to support research and citation analysis.
Instructions
Get author profile with optional publications list.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Input Schema (JSON Schema)
{
"$defs": {
"AuthorDetailsInput": {
"additionalProperties": false,
"properties": {
"author_id": {
"description": "Semantic Scholar author ID",
"minLength": 1,
"title": "Author Id",
"type": "string"
},
"include_papers": {
"default": true,
"description": "Include publications",
"title": "Include Papers",
"type": "boolean"
},
"papers_limit": {
"default": 20,
"description": "Max papers to return",
"maximum": 100,
"minimum": 1,
"title": "Papers Limit",
"type": "integer"
},
"response_format": {
"$ref": "#/$defs/ResponseFormat",
"default": "markdown",
"description": "Output format"
}
},
"required": [
"author_id"
],
"title": "AuthorDetailsInput",
"type": "object"
},
"ResponseFormat": {
"enum": [
"markdown",
"json"
],
"title": "ResponseFormat",
"type": "string"
}
},
"properties": {
"params": {
"$ref": "#/$defs/AuthorDetailsInput"
}
},
"required": [
"params"
],
"title": "get_author_detailsArguments",
"type": "object"
}
Implementation Reference
- Main handler function for semantic_scholar_get_author tool. Fetches author profile and papers from Semantic Scholar API using _make_request, formats output as markdown or JSON.@mcp.tool(name="semantic_scholar_get_author") async def get_author_details(params: AuthorDetailsInput) -> str: """Get author profile with optional publications list.""" logger.info(f"Getting author: {params.author_id}") author = await _make_request("GET", f"author/{params.author_id}", params={"fields": ",".join(AUTHOR_FIELDS)}) result = {"author": author} if params.include_papers: papers = await _make_request("GET", f"author/{params.author_id}/papers", params={"fields": ",".join(PAPER_FIELDS), "limit": params.papers_limit}) result["papers"] = papers.get("data", []) if params.response_format == ResponseFormat.JSON: return json.dumps(result, indent=2) lines = ["## Author Profile", "", _format_author_markdown(author)] if result.get("papers"): lines.extend(["---", f"### Publications ({len(result['papers'])} shown)", ""]) for p in result["papers"]: lines.append(f"- **{p.get('title', '?')}** ({p.get('year', '')}) - {p.get('citationCount', 0)} citations") return "\n".join(lines)
- Pydantic input schema for the semantic_scholar_get_author tool defining parameters: author_id (required), include_papers, papers_limit, response_format.class AuthorDetailsInput(BaseModel): model_config = ConfigDict(str_strip_whitespace=True, extra="forbid") author_id: str = Field(..., description="Semantic Scholar author ID", min_length=1) include_papers: bool = Field(default=True, description="Include publications") papers_limit: int = Field(default=20, description="Max papers to return", ge=1, le=100) response_format: ResponseFormat = Field(default=ResponseFormat.MARKDOWN, description="Output format")
- Helper function to format author profile data into a readable markdown string, used in the tool handler.def _format_author_markdown(author: Dict[str, Any]) -> str: lines = [f"### {author.get('name', 'Unknown')}"] affiliations = author.get("affiliations") or [] if affiliations: lines.append(f"**Affiliations:** {', '.join(affiliations[:3])}") lines.append(f"**h-index:** {author.get('hIndex')} | **Papers:** {author.get('paperCount', 0)} | **Citations:** {author.get('citationCount', 0)}") if author.get("homepage"): lines.append(f"**Homepage:** {author['homepage']}") if author.get("url"): lines.append(f"**Profile:** [{author.get('authorId')}]({author['url']})") lines.append("") return "\n".join(lines)
- Constant list of fields requested from Semantic Scholar author API endpoints.AUTHOR_FIELDS: List[str] = [ "authorId", "externalIds", "url", "name", "aliases", "affiliations", "homepage", "paperCount", "citationCount", "hIndex" ]
- src/semantic_scholar_mcp/server.py:348-348 (registration)MCP tool registration decorator specifying the tool name.@mcp.tool(name="semantic_scholar_get_author")