Skip to main content
Glama

remove_document

Delete specific documents from the MCP Knowledge Base Server by providing the document ID, ensuring accurate and up-to-date document management.

Instructions

从知识库中移除文档

Input Schema

NameRequiredDescriptionDefault
document_idYes文档ID

Input Schema (JSON Schema)

{ "properties": { "document_id": { "description": "文档ID", "type": "string" } }, "required": [ "document_id" ], "type": "object" }

Implementation Reference

  • Tool handler for 'remove_document' in MCP server switch statement. Extracts document_id from arguments, calls knowledgeBase.removeDocument(), and returns success/error message.
    case 'remove_document': { const { document_id } = args as { document_id: string }; const success = await this.knowledgeBase.removeDocument(document_id); return { content: [ { type: 'text', text: success ? `文档 "${document_id}" 已从知识库中移除` : `移除文档 "${document_id}" 失败,可能不存在` } ] }; }
  • Registers the 'remove_document' tool in the list of tools returned by ListToolsRequestHandler, including name, description, and input schema.
    { name: 'remove_document', description: '从知识库中移除文档', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: '文档ID' } }, required: ['document_id'] } },
  • Input schema definition for the 'remove_document' tool: requires a string 'document_id'.
    inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: '文档ID' } }, required: ['document_id'] } },
  • Core implementation of document removal: deletes document from internal Map and saves updated index to disk.
    async removeDocument(id: string): Promise<boolean> { const deleted = this.documents.delete(id); if (deleted) { await this.saveIndex(); } return deleted; }

Other Tools

Related 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