Skip to main content
Glama
ikungsjl

MCP Knowledge Base Server

by ikungsjl

list_documents

Retrieve all indexed documents from the knowledge base to browse available content for querying and analysis.

Instructions

列出知识库中的所有文档

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the 'list_documents' tool. It fetches all documents from the KnowledgeBase using getAllDocuments() and formats a detailed list including document ID, title, file type, path, and creation time into a text response.
    case 'list_documents': {
      const documents = await this.knowledgeBase.getAllDocuments();
      let resultText = `知识库中共有 ${documents.length} 个文档:\n\n`;
      
      documents.forEach((doc, index) => {
        resultText += `${index + 1}. ${doc.title} (ID: ${doc.id})\n`;
        resultText += `   类型: ${doc.fileType}\n`;
        resultText += `   路径: ${doc.filePath}\n`;
        resultText += `   创建时间: ${doc.createdAt.toLocaleString()}\n\n`;
      });
    
      return {
        content: [
          {
            type: 'text',
            text: resultText
          }
        ]
      };
    }
  • Tool schema definition for 'list_documents', including name, description, and empty input schema (no parameters required). This is part of the tools list returned in ListToolsRequest.
    {
      name: 'list_documents',
      description: '列出知识库中的所有文档',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },
  • Helper method in KnowledgeBase class that returns an array of all stored documents, used by the list_documents tool handler.
    async getAllDocuments(): Promise<Document[]> {
      return Array.from(this.documents.values());
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists all documents, implying a read-only operation, but doesn't mention any behavioral traits such as permissions required, pagination, rate limits, or what the output format looks like (e.g., list of document names or full metadata). This leaves significant gaps for an agent to understand how to use it effectively.

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 a single, clear sentence in Chinese: '列出知识库中的所有文档' (List all documents in the knowledge base). It's front-loaded with the core action and resource, with zero wasted words or redundant information. This is optimally concise for a simple tool.

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

Completeness2/5

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

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description is minimal but adequate for basic understanding. However, it lacks context about the output (e.g., what data is returned, format, or limitations like pagination), which is important since there's no output schema. For a list operation, more detail on behavioral aspects would improve 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?

The tool has 0 parameters, and the schema description coverage is 100% (as there are no parameters to describe). The description doesn't need to add parameter semantics, so it meets the baseline expectation for a parameterless tool. No additional value is required beyond stating the purpose.

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 verb '列出' (list) and the resource '知识库中的所有文档' (all documents in the knowledge base), providing a specific action and target. However, it doesn't explicitly differentiate from sibling tools like 'get_document' (which likely retrieves a specific document) or 'query_knowledge_base' (which might search/filter documents), so it doesn't fully distinguish from alternatives.

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. There's no mention of prerequisites, exclusions, or comparisons to sibling tools like 'query_knowledge_base' (which might offer filtering) or 'get_document' (for single-document retrieval). It simply states what the tool does without contextual usage advice.

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/ikungsjl/mcp-knowledge-base'

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