Skip to main content
Glama
needle-ai

Needle MCP Server

Official
by needle-ai

needle_add_file

Add documents to a collection by providing a URL for download, processing them for text extraction, and indexing them for semantic search.

Instructions

Add a new document to a Needle collection by providing a URL for download. Supports multiple file formats including: - PDF documents - Microsoft Word files (DOC, DOCX) - Plain text files (TXT) - Web pages (HTML)

The document will be: 1. Downloaded from the provided URL 2. Processed for text extraction 3. Indexed for semantic search Use this tool when you need to: - Add new documents to a collection - Make documents searchable - Expand your knowledge base Important: Documents require processing time before they're searchable. Check processing status using needle_list_files before searching new content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYesThe unique collection identifier where the file will be added
nameYesA descriptive filename that will help identify this document in results
urlYesPublic URL where the document can be downloaded from

Implementation Reference

  • Executes the needle_add_file tool: validates collection_id, name, and url parameters, calls Needle client's collections.files.add() to upload the file from URL, and returns the new file ID.
    elif name == "needle_add_file": if not isinstance(arguments, dict) or not all(k in arguments for k in ["collection_id", "name", "url"]): raise ValueError("Missing required parameters") if not validate_collection_id(arguments["collection_id"]): raise ValueError("Invalid collection ID format") if not validate_url(arguments["url"]): raise ValueError("Invalid URL format") files = client.collections.files.add( collection_id=arguments["collection_id"], files=[FileToAdd(name=arguments["name"], url=arguments["url"])] ) result = {"file_id": files[0].id}
  • Input schema definition for needle_add_file tool, specifying required string parameters: collection_id, name, and url with descriptions.
    inputSchema={ "type": "object", "properties": { "collection_id": { "type": "string", "description": "The unique collection identifier where the file will be added" }, "name": { "type": "string", "description": "A descriptive filename that will help identify this document in results" }, "url": { "type": "string", "description": "Public URL where the document can be downloaded from" } }, "required": ["collection_id", "name", "url"] }
  • Registers the needle_add_file tool in the MCP server's list_tools() function with name, detailed description, and input schema.
    Tool( name="needle_add_file", description="""Add a new document to a Needle collection by providing a URL for download. Supports multiple file formats including: - PDF documents - Microsoft Word files (DOC, DOCX) - Plain text files (TXT) - Web pages (HTML) The document will be: 1. Downloaded from the provided URL 2. Processed for text extraction 3. Indexed for semantic search Use this tool when you need to: - Add new documents to a collection - Make documents searchable - Expand your knowledge base Important: Documents require processing time before they're searchable. Check processing status using needle_list_files before searching new content.""", inputSchema={ "type": "object", "properties": { "collection_id": { "type": "string", "description": "The unique collection identifier where the file will be added" }, "name": { "type": "string", "description": "A descriptive filename that will help identify this document in results" }, "url": { "type": "string", "description": "Public URL where the document can be downloaded from" } }, "required": ["collection_id", "name", "url"] } ),

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/needle-ai/needle-mcp'

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