Skip to main content
Glama

search_authors

Find academic authors by name using OpenAlex API, with options to sort by relevance or citations and filter by institution.

Instructions

Searches for authors using the OpenAlex API.

Args: query: The search name to look for the authors. sort_by: The sorting criteria ("relevance_score" or "cited_by_count"). institution_id: An optional institution id to filter search results. e.g., "https://openalex.org/I123456789" page: The page number of the results to retrieve (default: 1).

Returns: A JSON object containing a list of authors+ids, or an error message if the search fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
sort_byNorelevance_score
institution_idNo
pageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
pageYes
has_nextNo
per_pageYes
total_countNo

Implementation Reference

  • The main handler function for the 'search_authors' tool. It constructs a query to the OpenAlex API /authors endpoint, processes the results into Author objects wrapped in a PageResult, handles pagination, sorting, filtering by institution, and raises appropriate errors.
    @mcp.tool
    async def search_authors(
            query: str,
            sort_by: Literal["relevance_score", "cited_by_count"] = "relevance_score",
            institution_id: Optional[str] = None,
            page: int = 1,
    ) -> PageResult:
        """
        Searches for authors using the OpenAlex API.
    
        Args:
            query: The search name to look for the authors.
            sort_by: The sorting criteria ("relevance_score" or "cited_by_count").
            institution_id: An optional institution id to filter search results. e.g., "https://openalex.org/I123456789"
            page: The page number of the results to retrieve (default: 1).
    
        Returns:
            A JSON object containing a list of authors+ids, or an error message if the search fails.
        """
        query = sanitize_search_text(query)
    
        params = {
            "filter": f"default.search:\"{query}\"",
            "sort": f"{sort_by}:desc",
            "page": page,
            "per_page": 10,
        }
        if institution_id:
            params["filter"] += f",affiliations.institution.id:\"{institution_id}\""
    
        # Fetches search results from the OpenAlex API
        async with RequestAPI("https://api.openalex.org", default_params={"mailto": OPENALEX_MAILTO}) as api:
            logger.info(f"Searching for authors using: query={query}, sort_by={sort_by}, page={page}, institution_id={institution_id}")
            try:
                result = await api.aget("/authors", params=params)
    
                # Returns a message for when the search results are empty
                if result is None or len(result.get("results", []) or []) == 0:
                    error_message = "No authors found with the query."
                    logger.info(error_message)
                    raise ToolError(error_message)
    
                # Successfully returns the searched authors
                authors = Author.from_list(result.get("results", []) or [])
                success_message = f"Found {len(authors)} authors."
                logger.info(success_message)
    
                total_count = (result.get("meta", {}) or {}).get("count")
                if total_count and total_count > params["per_page"] * params["page"]:
                    has_next = True
                else:
                    has_next = None
                return PageResult(
                    data=Author.list_to_json(authors),
                    total_count=total_count,
                    per_page=params["per_page"],
                    page=params["page"],
                    has_next=has_next
                )
            except httpx.HTTPStatusError as e:
                error_message = f"Request failed with status: {e.response.status_code}"
                logger.error(error_message)
                raise ToolError(error_message)
            except httpx.RequestError as e:
                error_message = f"Network error: {str(e)}"
                logger.error(error_message)
                raise ToolError(error_message)
Behavior2/5

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

With no annotations provided, the description carries full burden but only mentions that it returns a JSON object or error message. It lacks details on rate limits, authentication needs, pagination behavior beyond the 'page' parameter, or what happens with empty results.

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

Conciseness4/5

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

The description is well-structured with clear sections for Args and Returns, and each sentence adds value. It could be slightly more concise by integrating the default values more seamlessly, but overall it's efficient.

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 4 parameters with 0% schema coverage and an output schema present, the description adequately covers parameters but lacks behavioral context (e.g., error conditions, API constraints). The output schema reduces the need to detail return values, but more operational guidance would help.

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?

Schema description coverage is 0%, but the description compensates by explaining all 4 parameters: 'query' as the search name, 'sort_by' with criteria options, 'institution_id' as an optional filter with an example, and 'page' with its default. This adds meaningful context beyond the bare schema.

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 searches for authors using the OpenAlex API, specifying the resource (authors) and action (search). However, it doesn't explicitly differentiate from sibling tools like 'search_institutions' or 'search_papers' beyond mentioning the resource type.

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?

No guidance is provided on when to use this tool versus alternatives like 'papers_by_author' or other search tools. The description only states what it does without context about use cases or prerequisites.

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/ErikNguyen20/ScholarScope-MCP'

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