Skip to main content
Glama

works_citing_paper

Retrieve papers that cite a specific academic work from the OpenAlex database, enabling researchers to track citation impact and discover related literature.

Instructions

Retrieves works that cite a given paper from the OpenAlex API.

Args: paper_id: An OpenAlex Work ID of target paper. e.g., "https://openalex.org/W123456789" sort_by: The sorting criteria ("cited_by_count", or "publication_date"). page: The page number of the results to retrieve (default: 1).

Returns: A JSON object containing a list of papers+ids citing the specific paper, or an error message if the retrieval fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYes
sort_byNocited_by_count
pageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
pageYes
has_nextNo
per_pageYes
total_countNo

Implementation Reference

  • The main handler function for the 'works_citing_paper' tool. It is decorated with @mcp.tool for registration and implements the logic to fetch works citing a given paper from the OpenAlex API using the filter 'cites:{paper_id}', with pagination and sorting.
    async def works_citing_paper(
            paper_id: str,
            sort_by: Literal["cited_by_count", "publication_date"] = "cited_by_count",
            page: int = 1,
    ) -> PageResult:
        """
        Retrieves works that cite a given paper from the OpenAlex API.
    
        Args:
            paper_id: An OpenAlex Work ID of target paper. e.g., "https://openalex.org/W123456789"
            sort_by: The sorting criteria ("cited_by_count", or "publication_date").
            page: The page number of the results to retrieve (default: 1).
    
        Returns:
            A JSON object containing a list of papers+ids citing the specific paper, or an error message if the retrieval fails.
        """
        params = {
            "filter": f"cites:{paper_id}",
            "sort": f"{sort_by}:desc",
            "page": page,
            "per_page": 10,
        }
    
        # 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 works citing paper using: paper_id={paper_id}, sort_by={sort_by}, page={page}")
            try:
                result = await api.aget("/works", 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 = f"No cites found for paper_id={paper_id}."
                    logger.info(error_message)
                    raise ToolError(error_message)
    
                # Successfully returns the searched papers
                works = Work.from_list(result.get("results", []) or [])
                success_message = f"Found {len(works)} cites to paper_id={paper_id}."
                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=Work.list_to_json(works),
                    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?

No annotations are provided, so the description carries the full burden. It mentions retrieval from an API and potential error messages, but lacks details on rate limits, authentication needs, pagination behavior beyond the 'page' parameter, or what the JSON structure looks like (though output schema exists). For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 front-loaded with the core purpose, followed by structured sections for args and returns. It's efficient with minimal waste, though the 'Returns' section could be slightly more concise given the output schema exists. Overall, it's well-structured and appropriately sized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which handles return values), no annotations, and moderate complexity with 3 parameters, the description is fairly complete. It covers purpose, parameters, and basic behavior, but lacks deeper context like error handling details or API-specific constraints, which slightly reduces completeness.

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%, so the description must compensate. It explains each parameter's purpose: 'paper_id' as the target paper ID with an example, 'sort_by' as sorting criteria with options, and 'page' as page number with default. This adds meaningful context beyond the schema's titles and enums, though it doesn't detail format constraints beyond the example.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Retrieves' and the resource 'works that cite a given paper from the OpenAlex API', specifying the exact operation. It distinguishes from siblings like 'referenced_works_in_paper' (which would find works referenced by a paper) and 'related_works_of_paper' (which might find conceptually related works), making the purpose specific and differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you need to find papers citing a specific paper, but it does not explicitly state when to use this tool versus alternatives like 'search_papers' (which might allow broader searches) or 'referenced_works_in_paper'. No exclusions or prerequisites are mentioned, leaving usage context somewhat implied rather than explicit.

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