Skip to main content
Glama
afrise

Academic Paper Search MCP Server

by afrise

search_by_topic

Locate academic papers by topic with optional date range and result limit. Retrieve structured search results for integration with AI models.

Instructions

Search for papers by topic with optional date range.

Note: Query length is limited to 300 characters. Longer queries will be automatically truncated.

Args:
    topic (str): Search query (max 300 chars)
    year_start (int, optional): Start year for date range
    year_end (int, optional): End year for date range  
    limit (int, optional): Maximum number of results to return (default 10)
    
Returns:
    str: Formatted search results or error message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
topicYes
year_endNo
year_startNo

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the search_by_topic tool. It queries the Semantic Scholar API for papers matching the topic within the specified year range, formats the results, and falls back to Crossref via search_papers if needed.
    @mcp.tool()
    async def search_by_topic(topic: str, year_start: int = None, year_end: int = None, limit: int = 10) -> str:
        """Search for papers by topic with optional date range. 
        
        Note: Query length is limited to 300 characters. Longer queries will be automatically truncated.
        
        Args:
            topic (str): Search query (max 300 chars)
            year_start (int, optional): Start year for date range
            year_end (int, optional): End year for date range  
            limit (int, optional): Maximum number of results to return (default 10)
            
        Returns:
            str: Formatted search results or error message
        """
        
        try:
            # Truncate long queries to prevent API errors
            MAX_QUERY_LENGTH = 300
            if len(topic) > MAX_QUERY_LENGTH:
                original_length = len(topic)
                topic = topic[:MAX_QUERY_LENGTH] + "..."
            
            # Try Semantic Scholar API first
            semantic_url = f"{SEMANTIC_SCHOLAR_API}/paper/search"
            params = {
                "query": topic.encode('utf-8').decode('utf-8'),
                "limit": limit,
                "fields": "title,authors,year,paperId,externalIds,abstract,venue,isOpenAccess,openAccessPdf,tldr"
            }
            if year_start and year_end:
                params["year"] = f"{year_start}-{year_end}"
                
            headers = {
                "Accept": "application/json",
                "Content-Type": "application/json; charset=utf-8"
            }
            data = await make_api_request(semantic_url, headers=headers, params=params)
            
            if data and 'data' in data:
                results = ["=== Search Results ==="]
                for paper in data['data']:
                    results.append(format_paper_data(paper, "semantic_scholar"))
                return "\n".join(results)
                
            # Fallback to Crossref if Semantic Scholar fails
            return await search_papers(topic, limit)
            
        except Exception as e:
            return f"Error searching papers!"
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context: the query length limit (300 characters with truncation) and the return type (formatted search results or error message). However, it lacks details on permissions, rate limits, error conditions beyond truncation, or pagination behavior, which are important for a search tool.

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 appropriately sized and well-structured. It starts with a clear purpose statement, adds a critical behavioral note (query length limit), and then lists parameters and returns in a formatted way. Every sentence adds value without redundancy, making it easy for an agent to parse quickly.

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's moderate complexity (4 parameters, no output schema, no annotations), the description is partially complete. It covers parameters and basic behavior but lacks output details (e.g., result format beyond 'formatted'), error handling specifics, and differentiation from siblings. For a search tool, this leaves gaps in guiding the agent effectively.

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

Parameters4/5

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

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: 'topic' as the search query with a character limit, 'year_start' and 'year_end' for date range, and 'limit' for maximum results with a default. This compensates well for the schema's lack of descriptions, though it could note that year parameters are optional integers.

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 tool's purpose: 'Search for papers by topic with optional date range.' It specifies the verb ('search'), resource ('papers'), and scope ('by topic with optional date range'), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'search_papers' or 'fetch_paper_details,' which would be needed for a perfect score.

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 like 'search_papers' or 'fetch_paper_details.' It mentions optional parameters like date range and limit, but doesn't explain scenarios where this tool is preferred over siblings or any prerequisites for usage. This leaves the agent without context for tool selection.

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

Related 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/afrise/academic-search-mcp-server'

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