Skip to main content
Glama

list_evidence_packs

Retrieve and browse saved evidence packs for academic literature management. View organized collections of research materials with pagination controls.

Instructions

列出所有证据包

查看已保存的证据包列表。

Args: limit: 返回数量限制,默认 20 offset: 分页偏移量,默认 0

Returns: 证据包列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
offsetNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'list_evidence_packs' tool. It uses a SQL query to fetch paginated list of evidence packs from the database, including counts of items and documents per pack, and returns structured JSON with total count and pack summaries.
    @mcp.tool()
    def list_evidence_packs(limit: int = 20, offset: int = 0) -> dict[str, Any]:
        """列出所有证据包
        
        查看已保存的证据包列表。
        
        Args:
            limit: 返回数量限制,默认 20
            offset: 分页偏移量,默认 0
            
        Returns:
            证据包列表
        """
        try:
            packs = query_all(
                """
                SELECT 
                    ep.pack_id,
                    ep.query,
                    ep.created_at::text,
                    COUNT(epi.id) as item_count,
                    COUNT(DISTINCT epi.doc_id) as doc_count
                FROM evidence_packs ep
                LEFT JOIN evidence_pack_items epi ON ep.pack_id = epi.pack_id
                GROUP BY ep.pack_id
                ORDER BY ep.created_at DESC
                LIMIT %s OFFSET %s
                """,
                (limit, offset)
            )
            
            total = query_one("SELECT COUNT(*) as count FROM evidence_packs")
            
            return {
                "total": total["count"] if total else 0,
                "limit": limit,
                "offset": offset,
                "packs": [
                    {
                        "pack_id": p["pack_id"],
                        "query": p["query"],
                        "created_at": p["created_at"],
                        "item_count": p["item_count"],
                        "doc_count": p["doc_count"],
                    }
                    for p in packs
                ],
            }
            
        except Exception as e:
            return {
                "error": str(e),
                "total": 0,
                "packs": [],
            }
  • The registration of writing tools (including list_evidence_packs) via import and call to register_writing_tools(mcp) on the FastMCP server instance.
    from paperlib_mcp.tools.writing import register_writing_tools
    
    # M2 GraphRAG 工具
    from paperlib_mcp.tools.graph_extract import register_graph_extract_tools
    from paperlib_mcp.tools.graph_canonicalize import register_graph_canonicalize_tools
    from paperlib_mcp.tools.graph_community import register_graph_community_tools
    from paperlib_mcp.tools.graph_summarize import register_graph_summarize_tools
    from paperlib_mcp.tools.graph_maintenance import register_graph_maintenance_tools
    
    # M3 Review 工具
    from paperlib_mcp.tools.review import register_review_tools
    
    # M4 Canonicalization & Grouping 工具
    from paperlib_mcp.tools.graph_relation_canonicalize import register_graph_relation_canonicalize_tools
    from paperlib_mcp.tools.graph_claim_grouping import register_graph_claim_grouping_tools
    from paperlib_mcp.tools.graph_v12 import register_graph_v12_tools
    
    register_health_tools(mcp)
    register_import_tools(mcp)
    register_search_tools(mcp)
    register_fetch_tools(mcp)
    register_writing_tools(mcp)
  • Supporting helper function get_evidence_pack used in other writing tools, but referenced in the context of evidence packs.
    def get_evidence_pack(pack_id: int) -> EvidencePack | None:
        """获取证据包内容
        
        Args:
            pack_id: 证据包 ID
            
        Returns:
            证据包对象,如果不存在返回 None
        """
        # 获取证据包元数据
        pack = query_one(
            """
            SELECT pack_id, query, params_json, created_at::text
            FROM evidence_packs
            WHERE pack_id = %s
            """,
            (pack_id,)
        )
        
        if not pack:
            return None
        
        # 获取证据包条目
        items = query_all(
            """
            SELECT 
                epi.doc_id,
                epi.chunk_id,
                epi.rank,
                c.page_start,
                c.page_end,
                c.text
            FROM evidence_pack_items epi
            JOIN chunks c ON epi.chunk_id = c.chunk_id
            WHERE epi.pack_id = %s
            ORDER BY epi.rank
            """,
            (pack_id,)
        )
        
        # 统计
        unique_docs = len(set(item["doc_id"] for item in items))
        
        return EvidencePack(
            pack_id=pack["pack_id"],
            query=pack["query"],
            params=pack["params_json"] or {},
            items=[
                EvidencePackItem(
                    doc_id=item["doc_id"],
                    chunk_id=item["chunk_id"],
                    page_start=item["page_start"],
                    page_end=item["page_end"],
                    text=item["text"],
                    score=1.0 / (item["rank"] + 1) if item["rank"] is not None else 0.5,  # 基于排名的伪分数
                )
                for item in items
            ],
            stats={
                "total_chunks": len(items),
                "unique_docs": unique_docs,
            }
        )
  • Pydantic model for EvidencePack structure, used in related tools for type safety and serialization.
    class EvidencePack(BaseModel):
        """证据包"""
        pack_id: int
        query: str
        params: dict[str, Any]
        items: list[EvidencePackItem]
        stats: dict[str, Any]
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 of behavioral disclosure. It states the tool lists evidence packs, implying a read-only operation, but doesn't disclose any behavioral traits such as authentication requirements, rate limits, error conditions, or whether it's a safe operation. The description is minimal and lacks context beyond the basic action, leaving gaps in understanding how the tool behaves in practice.

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 appropriately sized and front-loaded: it starts with the main purpose ('列出所有证据包'), followed by a brief elaboration ('查看已保存的证据包列表'), and then details parameters and returns. Each sentence adds value without redundancy. However, it could be slightly more structured (e.g., separating usage guidelines), but it's efficient overall.

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 low complexity (a simple list operation with 2 parameters) and the presence of an output schema (implied by 'Returns: 证据包列表'), the description is somewhat complete. It covers the purpose and parameters, but lacks behavioral context (e.g., safety, permissions) and usage guidelines. With no annotations and minimal output explanation, it's adequate but has clear gaps, making it a minimum viable description.

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 meaningful semantics for both parameters: 'limit' is explained as '返回数量限制,默认 20' (return quantity limit, default 20) and 'offset' as '分页偏移量,默认 0' (pagination offset, default 0). This provides clear context beyond the input schema, which has 0% description coverage and only defines types and defaults. Since there are only 2 parameters and the description covers them adequately, it compensates well for the low schema coverage.

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: '列出所有证据包' (list all evidence packs) and '查看已保存的证据包列表' (view the list of saved evidence packs). It uses specific verbs ('列出', '查看') and identifies the resource ('证据包' - evidence packs). However, it doesn't explicitly differentiate from sibling tools like 'get_evidence_pack_info' or 'build_evidence_pack', which is why it doesn't reach a score of 5.

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. It doesn't mention sibling tools like 'get_evidence_pack_info' (which might retrieve details of a specific pack) or 'build_evidence_pack' (which might create packs), nor does it specify prerequisites or context for usage. The only implied usage is for listing evidence packs, but without explicit alternatives or exclusions.

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/h-lu/paperlib-mcp'

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