Skip to main content
Glama
needle-ai

Needle MCP Server

Official
by needle-ai

needle_search

Search documents using semantic understanding to find relevant content based on meaning rather than keywords. Understands natural language queries and returns ranked passages with source information.

Instructions

Perform intelligent semantic search across documents in a Needle collection. This tool uses advanced embedding technology to find relevant content based on meaning, not just keywords. The search: - Understands natural language queries - Finds conceptually related content - Returns relevant text passages with source information - Ranks results by semantic relevance

Use this tool when you need to: - Find specific information within documents - Answer questions from document content - Research topics across multiple documents - Locate relevant passages and their sources More effective than traditional keyword search for: - Natural language questions - Conceptual queries - Finding related content Returns matching text passages with their source file IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYesThe unique collection identifier to search within
queryYesNatural language query describing the information you're looking for

Implementation Reference

  • Executes the needle_search tool by validating arguments, calling NeedleClient.collections.search(), formatting results with content and file_id, and returning as JSON TextContent.
    elif name == "needle_search": if not isinstance(arguments, dict) or not all(k in arguments for k in ["collection_id", "query"]): raise ValueError("Missing required parameters") results = client.collections.search( collection_id=arguments["collection_id"], text=arguments["query"], # Optionally add these parameters if needed: # max_distance=0.8, # Adjust threshold as needed # top_k=5 # Adjust number of results as needed ) result = [{ "content": r.content, "file_id": r.file_id, } for r in results] return [TextContent( type="text", text=json.dumps(result, indent=2, default=str) )]
  • Input schema for needle_search tool defining required collection_id and query parameters as strings.
    inputSchema={ "type": "object", "properties": { "collection_id": { "type": "string", "description": "The unique collection identifier to search within" }, "query": { "type": "string", "description": "Natural language query describing the information you're looking for" } }, "required": ["collection_id", "query"] }
  • Registers the needle_search tool with the MCP server via list_tools(), including name, detailed description, and input schema.
    Tool( name="needle_search", description="""Perform intelligent semantic search across documents in a Needle collection. This tool uses advanced embedding technology to find relevant content based on meaning, not just keywords. The search: - Understands natural language queries - Finds conceptually related content - Returns relevant text passages with source information - Ranks results by semantic relevance Use this tool when you need to: - Find specific information within documents - Answer questions from document content - Research topics across multiple documents - Locate relevant passages and their sources More effective than traditional keyword search for: - Natural language questions - Conceptual queries - Finding related content Returns matching text passages with their source file IDs.""", inputSchema={ "type": "object", "properties": { "collection_id": { "type": "string", "description": "The unique collection identifier to search within" }, "query": { "type": "string", "description": "Natural language query describing the information you're looking for" } }, "required": ["collection_id", "query"] } )

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