Skip to main content
Glama
DaniManas
by DaniManas

get_paper_abstract

Retrieve complete abstracts for academic papers using OpenAlex IDs to support detailed research analysis and paper evaluation.

Instructions

Get the full abstract for a specific paper.

Args: paper_id: The OpenAlex paper ID (from search_papers results)

Returns: The paper's abstract text with title and metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes

Implementation Reference

  • Primary MCP tool handler for 'get_paper_abstract'. Fetches paper by ID using PaperFetcher, extracts abstract with helper method, formats and returns structured response including title, authors, year, citations, and full abstract text.
    @mcp.tool()
    def get_paper_abstract(paper_id: str) -> str:
        """
        Get the full abstract for a specific paper.
    
        Args:
            paper_id: The OpenAlex paper ID (from search_papers results)
    
        Returns:
            The paper's abstract text with title and metadata
        """
        paper = fetcher.fetch_paper_by_id(paper_id)
    
        if "error" in paper:
            return paper["error"]
    
        abstract_text = fetcher.get_paper_abstract(paper)
    
        result = f"**{paper['title']}**\n"
        result += f"Authors: {paper['authors']}\n"
        result += f"Year: {paper['publication_year']}\n"
        result += f"Citations: {paper['cited_by_count']}\n\n"
        result += f"**Abstract:**\n{abstract_text}\n"
    
        return result
  • Supporting helper method in PaperFetcher class that reconstructs the paper's abstract from OpenAlex's inverted index format (word positions) into readable plain text.
    def get_paper_abstract(self, paper_data: Dict) -> str:
        """
        Convert OpenAlex inverted index abstract to readable text.
    
        Args:
            paper_data: Paper dictionary containing abstract in inverted index format
    
        Returns:
            Readable abstract text
        """
        inverted_index = paper_data.get("abstract")
    
        if not inverted_index:
            return "No abstract available"
    
        word_positions = []
        for word, positions in inverted_index.items():
            for pos in positions:
                word_positions.append((pos, word))
    
        word_positions.sort(key=lambda x: x[0])
        abstract = " ".join([word for _, word in word_positions])
    
        return abstract
  • src/server.py:47-47 (registration)
    The @mcp.tool() decorator registers the get_paper_abstract function as an MCP tool.
    @mcp.tool()
  • Helper method that fetches detailed paper data from OpenAlex API by ID, which is used by the tool handler to retrieve paper metadata before extracting the abstract.
    def fetch_paper_by_id(self, paper_id: str) -> Dict:

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/DaniManas/ResearchMCP'

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