Skip to main content
Glama
lingqukan

arXiv MCP Server

by lingqukan

cleanup_papers

Remove papers from the arXiv database using filters like date or category to manage local storage and keep research collections current.

Instructions

Delete papers from the local database by date and/or category.

At least one filter must be provided to prevent accidental full deletion.
Filters are combined with AND logic.

Args:
    before_date: Delete papers published before this date (exclusive), e.g. "2026-03-01"
    date: Delete papers published on this specific date, e.g. "2026-03-18"
    categories: Delete only papers in these categories (OR logic), e.g. ["cs.AI", "cs.LG"]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
before_dateNo
dateNo
categoriesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The cleanup_papers tool implementation, registered as an MCP tool, which calls db.delete_papers to remove records from the database based on filters.
    def cleanup_papers(
        before_date: Optional[str] = None,
        date: Optional[str] = None,
        categories: Optional[List[str]] = None,
    ) -> str:
        """Delete papers from the local database by date and/or category.
    
        At least one filter must be provided to prevent accidental full deletion.
        Filters are combined with AND logic.
    
        Args:
            before_date: Delete papers published before this date (exclusive), e.g. "2026-03-01"
            date: Delete papers published on this specific date, e.g. "2026-03-18"
            categories: Delete only papers in these categories (OR logic), e.g. ["cs.AI", "cs.LG"]
        """
        if not before_date and not date and not categories:
            return json.dumps(
                {"error": "At least one filter (before_date, date, categories) must be provided."},
                ensure_ascii=False,
                indent=2,
            )
        if before_date and date:
            return json.dumps(
                {"error": "before_date and date are mutually exclusive; provide only one."},
                ensure_ascii=False,
                indent=2,
            )
        date_re = re.compile(r"^\d{4}-\d{2}-\d{2}$")
        for field_name, value in (("before_date", before_date), ("date", date)):
            if value and not date_re.match(value):
                return json.dumps(
                    {"error": f"Invalid {field_name} format: {value!r}. Expected YYYY-MM-DD."},
                    ensure_ascii=False,
                    indent=2,
                )
        logger.info(f"Deleting papers: before_date={before_date!r}, date={date!r}, categories={categories}")
        db = _get_db()
        deleted = db.delete_papers(before_date=before_date, date=date, categories=categories)
        return json.dumps({"status": "ok", "deleted": deleted}, ensure_ascii=False, indent=2)
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses: destructive nature, safety guardrails (requires ≥1 filter), AND logic between filter types, OR logic within categories, and exclusive date boundary. Could further clarify permanence/irreversibility of deletion.

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?

Well-structured with safety constraint front-loaded. Main clause establishes operation, followed by constraint, logic explanation, and Args section with examples. Slightly verbose Args section necessary given zero schema coverage.

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?

Appropriate for complexity: covers safety critical for destructive tool, explains parameter interactions (AND/OR), and output schema exists so return values need no description. Missing explicit note that deletion is permanent/irreversible.

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

Parameters5/5

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

Schema has 0% description coverage (only titles). Description fully compensates by providing semantic meaning, format examples ('2026-03-01'), and logic constraints (exclusive, specific, OR logic) for all 3 parameters.

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?

Specific verb 'Delete' + resource 'papers' + scope 'local database' + mechanism 'by date and/or category'. Implicitly distinguishes from read-only siblings (fetch_papers, query_papers, count_papers) through explicit destructive language.

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?

Excellent safety constraint: 'At least one filter must be provided to prevent accidental full deletion.' Explains filter logic (AND between fields). Missing explicit reference to sibling query_papers for previewing deletions, but includes critical guardrails.

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

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