Skip to main content
Glama
jumasheff

RAG Documentation MCP Server

by jumasheff

remove_documentation

Remove outdated or incorrect documentation sources by URL to clean up your RAG system and improve search accuracy.

Instructions

Remove specific documentation sources from the system by their URLs. Use this tool to clean up outdated documentation, remove incorrect sources, or manage the documentation collection. The removal is permanent and will affect future search results. Supports removing multiple URLs in a single operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlsYesArray of URLs to remove from the database

Implementation Reference

  • RemoveDocumentationHandler class implementing the core execution logic for the 'remove_documentation' tool. Deletes documentation from Qdrant collection using URL filters, with input validation and error handling.
    export class RemoveDocumentationHandler extends BaseHandler {
      async handle(args: any): Promise<McpToolResponse> {
        if (!args.urls || !Array.isArray(args.urls) || args.urls.length === 0) {
          throw new McpError(ErrorCode.InvalidParams, 'urls must be a non-empty array');
        }
    
        if (!args.urls.every((url: string) => typeof url === 'string')) {
          throw new McpError(ErrorCode.InvalidParams, 'All URLs must be strings');
        }
    
        try {
          // Delete using filter to match any of the provided URLs
          const result = await this.apiClient.qdrantClient.delete(COLLECTION_NAME, {
            filter: {
              should: args.urls.map((url: string) => ({
                key: 'url',
                match: { value: url }
              }))
            },
            wait: true // Ensure deletion is complete before responding
          });
    
          if (!['acknowledged', 'completed'].includes(result.status)) {
            throw new Error('Delete operation failed');
          }
    
          return {
            content: [
              {
                type: 'text',
                text: `Successfully removed documentation from ${args.urls.length} source${args.urls.length > 1 ? 's' : ''}: ${args.urls.join(', ')}`,
              },
            ],
          };
        } catch (error) {
          if (error instanceof Error) {
            if (error.message.includes('unauthorized')) {
              throw new McpError(
                ErrorCode.InvalidRequest,
                'Failed to authenticate with Qdrant cloud while removing documentation'
              );
            } else if (error.message.includes('ECONNREFUSED') || error.message.includes('ETIMEDOUT')) {
              throw new McpError(
                ErrorCode.InternalError,
                'Connection to Qdrant cloud failed while removing documentation'
              );
            }
          }
          return {
            content: [
              {
                type: 'text',
                text: `Failed to remove documentation: ${error}`,
              },
            ],
            isError: true,
          };
        }
      }
    }
  • Tool schema definition for 'remove_documentation' returned by list_tools request handler.
    {
      name: 'remove_documentation',
      description: 'Remove specific documentation sources from the system by their URLs. Use this tool to clean up outdated documentation, remove incorrect sources, or manage the documentation collection. The removal is permanent and will affect future search results. Supports removing multiple URLs in a single operation.',
      inputSchema: {
        type: 'object',
        properties: {
          urls: {
            type: 'array',
            items: {
              type: 'string',
              description: 'The complete URL of the documentation source to remove. Must exactly match the URL used when the documentation was added.',
            },
            description: 'Array of URLs to remove from the database',
          },
        },
        required: ['urls'],
      },
    } as ToolDefinition,
  • Registers the RemoveDocumentationHandler instance under the 'remove_documentation' tool name in the handler map used for call_tool requests.
    this.handlers.set('remove_documentation', new RemoveDocumentationHandler(this.server, this.apiClient));
  • Alternative tool definition/schema in the BaseTool subclass.
    get definition(): ToolDefinition {
      return {
        name: 'remove_documentation',
        description: 'Remove one or more documentation sources by their URLs',
        inputSchema: {
          type: 'object',
          properties: {
            urls: {
              type: 'array',
              items: {
                type: 'string',
                description: 'URL of a documentation source to remove'
              },
              description: 'Array of URLs to remove. Can be a single URL or multiple URLs.',
              minItems: 1
            }
          },
          required: ['urls'],
        },
      };
    }
  • RemoveDocumentationTool class with execute method implementing similar logic, possibly for client-side or alternative use.
    export class RemoveDocumentationTool extends BaseTool {
      private apiClient: ApiClient;
    
      constructor(apiClient: ApiClient) {
        super();
        this.apiClient = apiClient;
      }
    
      get definition(): ToolDefinition {
        return {
          name: 'remove_documentation',
          description: 'Remove one or more documentation sources by their URLs',
          inputSchema: {
            type: 'object',
            properties: {
              urls: {
                type: 'array',
                items: {
                  type: 'string',
                  description: 'URL of a documentation source to remove'
                },
                description: 'Array of URLs to remove. Can be a single URL or multiple URLs.',
                minItems: 1
              }
            },
            required: ['urls'],
          },
        };
      }
    
      async execute(args: { urls: string[] }): Promise<McpToolResponse> {
        if (!Array.isArray(args.urls) || args.urls.length === 0) {
          throw new McpError(ErrorCode.InvalidParams, 'At least one URL is required');
        }
    
        if (!args.urls.every(url => typeof url === 'string')) {
          throw new McpError(ErrorCode.InvalidParams, 'All URLs must be strings');
        }
    
        try {
          // Delete using filter to match any of the provided URLs
          const result = await this.apiClient.qdrantClient.delete(COLLECTION_NAME, {
            filter: {
              should: args.urls.map(url => ({
                key: 'url',
                match: { value: url }
              }))
            },
            wait: true
          });
    
          if (!['acknowledged', 'completed'].includes(result.status)) {
            throw new Error('Delete operation failed');
          }
    
          return {
            content: [
              {
                type: 'text',
                text: `Successfully removed documentation from ${args.urls.length} source${args.urls.length > 1 ? 's' : ''}: ${args.urls.join(', ')}`,
              },
            ],
          };
        } catch (error) {
          if (error instanceof Error) {
            if (error.message.includes('unauthorized')) {
              throw new McpError(
                ErrorCode.InvalidRequest,
                'Failed to authenticate with Qdrant cloud while removing documentation'
              );
            } else if (error.message.includes('ECONNREFUSED') || error.message.includes('ETIMEDOUT')) {
              throw new McpError(
                ErrorCode.InternalError,
                'Connection to Qdrant cloud failed while removing documentation'
              );
            }
          }
          return {
            content: [
              {
                type: 'text',
                text: `Failed to remove documentation: ${error}`,
              },
            ],
            isError: true,
          };
        }
      }
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well: it discloses permanence ('removal is permanent'), impact ('will affect future search results'), and batch capability ('supports removing multiple URLs'). However, it lacks details on error handling or permission requirements.

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?

Three sentences with zero waste: first states purpose, second gives usage context, third covers behavioral traits. Each sentence earns its place, and key information is front-loaded.

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?

For a destructive tool with no annotations or output schema, the description is reasonably complete—covering purpose, usage, and key behavioral warnings. However, it could mention response format or error cases for full completeness.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents the 'urls' parameter fully. The description adds minimal value beyond implying batch operations, matching the baseline score when schema does heavy lifting.

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 verb ('Remove') and resource ('specific documentation sources by their URLs'), distinguishing it from siblings like 'list_sources' (read-only) or 'search_documentation' (query-focused). It specifies the action is targeted removal rather than bulk clearing.

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 ('clean up outdated documentation, remove incorrect sources, or manage the documentation collection'), but does not explicitly mention when NOT to use it or name specific alternatives among siblings (e.g., 'clear_queue' might be for different cleanup).

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/jumasheff/mcp-ragdoc-fork'

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