Skip to main content
Glama

get_paper

Retrieve arXiv paper text by ID, with options to get full content or specific sections like abstract, introduction, method, or conclusion.

Instructions

Get the full text of an arXiv paper.

Args: paper_id: arXiv paper ID (e.g., "2401.12345") section: Which section to return: "all", "abstract", "introduction", "method", "conclusion" Returns: The paper text (full or specified section)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
sectionNoall

Implementation Reference

  • The @mcp.tool()-decorated function that implements the 'get_paper' tool. It retrieves paper text from cache if available, otherwise searches, downloads the PDF, extracts text using pdf_parser, caches it, and returns the full text or a specific section.
    @mcp.tool() def get_paper(paper_id: str, section: str = "all") -> str: """Get the full text of an arXiv paper. Args: paper_id: arXiv paper ID (e.g., "2401.12345") section: Which section to return: "all", "abstract", "introduction", "method", "conclusion" Returns: The paper text (full or specified section) """ # Check cache first cached_text = storage.get_text(paper_id) if cached_text: if section == "all": return cached_text return extract_section(cached_text, section) # Search for the paper papers = search_papers(paper_id, max_results=1) if not papers: return f"Paper {paper_id} not found." paper = papers[0] # Download PDF pdf_path = storage.get_pdf_path(paper_id) try: download_pdf(paper, str(pdf_path)) except Exception as e: return f"Failed to download paper: {e}" # Extract text try: full_text = extract_text(str(pdf_path)) except Exception as e: return f"Failed to extract text from PDF: {e}" # Cache results storage.save_paper_metadata(paper) storage.save_text(paper_id, full_text) if section == "all": return full_text return extract_section(full_text, section)
  • The @mcp.tool() decorator registers the get_paper function as an MCP tool.
    @mcp.tool()
  • Function signature and docstring defining input parameters (paper_id, section) and return type, used by FastMCP for tool schema.
    def get_paper(paper_id: str, section: str = "all") -> str: """Get the full text of an arXiv paper. Args: paper_id: arXiv paper ID (e.g., "2401.12345") section: Which section to return: "all", "abstract", "introduction", "method", "conclusion" Returns: The paper text (full or specified section) """

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/AnnaSuSu/arxiv-mcp'

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