Skip to main content
Glama

fetch_fulltext

Read-onlyIdempotent

Retrieve full-text academic paper content from provided URLs, returning plain text while noting potential access restrictions.

Instructions

Retrieves the contents of a paper or work from its preferred full-text URL and returns the response body as plain text.

Note: In some cases, the target content may be paywalled, require authentication, or otherwise restrict access. In such situations, the returned output may consist of partial content, metadata, or an access notice rather than the complete text.

Args: preferred_fulltext_url: Preferred full-text URL of the paper or work.

Returns: Plaintext representation of the retrieved content. This may be the complete text, or a limited excerpt if access to the full resource is restricted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
preferred_fulltext_urlYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The fetch_fulltext tool is implemented as an async handler function decorated with @mcp.tool for registration. It normalizes the URL by stripping Jina prefix if present, validates it against SSRF guards, fetches the content via Jina proxy (r.jina.ai), handles various errors, and returns the plain text content.
    @mcp.tool(annotations={"readOnlyHint": True, "idempotentHint": True})
    async def fetch_fulltext(preferred_fulltext_url: str, ctx: Context) -> str:
        """
        Retrieves the contents of a paper or work from its preferred full-text URL and returns
        the response body as plain text.
    
        Note:
            In some cases, the target content may be paywalled, require authentication, or
            otherwise restrict access. In such situations, the returned output may consist
            of partial content, metadata, or an access notice rather than the complete text.
    
        Args:
            preferred_fulltext_url: Preferred full-text URL of the paper or work.
    
        Returns:
            Plaintext representation of the retrieved content. This may be the complete text,
            or a limited excerpt if access to the full resource is restricted.
        """
        # Strip Jina prefix if already present
        jina_prefix = "https://r.jina.ai/"
        if preferred_fulltext_url.startswith(jina_prefix):
            preferred_fulltext_url = preferred_fulltext_url[len(jina_prefix):]
            logger.debug(f"Removed Jina prefix, normalized URL: {preferred_fulltext_url}")
    
        # Validates to prevent malicious/malformed urls
        if not validate_url_with_ssrf_guard(preferred_fulltext_url):
            error_message = f"Invalid or Disallowed URL: {preferred_fulltext_url}"
            logger.error(error_message)
            await ctx.error(error_message)
            raise ResourceError(error_message)
    
        async with RequestAPI(jina_prefix[:-1]) as api:
            logger.info(f"Fetching page: url={preferred_fulltext_url}")
            await ctx.info(f"Fetching full-text from the url...")
            try:
                # Fetch contents of the page (wrapped with jina for easy LLM reading)
                result = await api.aget(f"/{preferred_fulltext_url}")
                if result is None:
                    error_message = "Response is empty content. Try again later."
                    logger.info(error_message)
                    await ctx.error(error_message)
                    raise ToolError(error_message)
    
                return result
            except httpx.HTTPStatusError as e:
                error_message = f"Request failed with status: {e.response.status_code}"
                logger.error(error_message)
                await ctx.error(error_message)
                raise ResourceError(error_message)
            except httpx.RequestError as e:
                error_message = f"Network error: {str(e)}"
                logger.error(error_message)
                await ctx.error(error_message)
                raise ResourceError(error_message)
  • src/server.py:456-456 (registration)
    The @mcp.tool decorator registers the fetch_fulltext function as an MCP tool with readOnlyHint and idempotentHint annotations.
    @mcp.tool(annotations={"readOnlyHint": True, "idempotentHint": True})
Behavior4/5

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

The description adds valuable behavioral context beyond the annotations (readOnlyHint, idempotentHint) by disclosing potential access restrictions (paywalls, authentication) and possible partial outputs. This helps the agent understand real-world limitations, though it doesn't cover rate limits or detailed error handling.

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 well-structured with a clear main statement, a note section for important caveats, and separate Args/Returns sections. Every sentence adds value without redundancy, making it efficient and easy to parse.

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

Completeness5/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 (single parameter, read-only/idempotent annotations, output schema exists), the description is complete. It covers purpose, usage notes, parameter meaning, and output behavior, with the output schema handling return value details, leaving no significant gaps.

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?

With 0% schema description coverage, the description fully compensates by explaining the parameter's meaning ('Preferred full-text URL of the paper or work'), adding essential semantics not present in the schema. It clarifies what the URL represents, though it could provide more on format or validation.

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 tool's purpose with specific verbs ('retrieves', 'returns') and resources ('contents of a paper or work', 'preferred full-text URL'), distinguishing it from sibling tools that search or list papers rather than fetch full content. It precisely defines what the tool does without ambiguity.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (to get full-text content from a URL) but does not explicitly mention when not to use it or name specific alternatives among the sibling tools. It implies usage for retrieving text content rather than metadata or search operations.

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