Skip to main content
Glama
needle-ai

Needle MCP Server

Official
by needle-ai

needle_list_collections

Retrieve available document collections with IDs and metadata for managing Needle operations.

Instructions

List Needle collections. Returns maximum of 20 results. Get more results by increasing the offset. Returns detailed information including collection IDs, names, and creation dates. Use this tool when you need to: - Get an overview of available document collections - Find collection IDs for subsequent operations - Verify collection existence before performing operations The response includes metadata that's required for other Needle operations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
offsetNoThe offset to start listing from. Default is 0.

Implementation Reference

  • Handler implementation for the needle_list_collections tool. Retrieves collections from Needle client, applies pagination with offset (max 20 results), and prepares JSON response.
    if name == "needle_list_collections":
        offset = 0
        if isinstance(arguments, dict) and "offset" in arguments:
            offset = int(arguments["offset"])
        
        collections = client.collections.list()
        collection_data = [{"id": c.id, "name": c.name, "created_at": str(c.created_at)} for c in collections]
        
        # Apply pagination
        paginated_collections = collection_data[offset:offset + 20]
        result = {"collections": paginated_collections}
  • Input schema for needle_list_collections tool defining optional offset parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "offset": {
                "type": "number",
                "description": "The offset to start listing from. Default is 0.",
                "default": 0
            }
        },
        "required": []
    }
  • Registration of the needle_list_collections tool in the list_tools() function, including name, description, and input schema.
    Tool(
        name="needle_list_collections",
        description="""List Needle collections. Returns maximum of 20 results. Get more results by increasing the offset.
        Returns detailed information including collection IDs, names, and creation dates. Use this tool when you need to:
        - Get an overview of available document collections
        - Find collection IDs for subsequent operations
        - Verify collection existence before performing operations
        The response includes metadata that's required for other Needle operations.""",
        inputSchema={
            "type": "object",
            "properties": {
                "offset": {
                    "type": "number",
                    "description": "The offset to start listing from. Default is 0.",
                    "default": 0
                }
            },
            "required": []
        }
    ),
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it's a read operation (implied by 'List'), returns up to 20 results, supports pagination via offset, and includes metadata required for other operations. It doesn't mention rate limits or auth needs, but covers essential functionality adequately for a listing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with key information (purpose, limit, pagination), followed by use cases. It could be slightly more concise by merging some sentences, but every sentence adds value, such as clarifying the response content and operational context. No wasted words, but minor tightening is possible.

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?

Given the tool's low complexity (1 optional parameter, no output schema, no annotations), the description is quite complete. It covers purpose, usage, behavioral traits like pagination and result limits, and contextual value for other operations. It doesn't detail exact return formats, but for a listing tool without an output schema, this is sufficient.

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%, with the parameter 'offset' fully documented in the schema. The description adds context by explaining how to use offset ('Get more results by increasing the offset'), which provides practical guidance beyond the schema's default value. This meets the baseline of 3 since the schema handles most of the documentation.

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 ('List') and resource ('Needle collections'), distinguishing it from siblings like 'needle_create_collection' (creation) and 'needle_get_collection_details' (detailed view). It specifies the scope ('maximum of 20 results') and purpose ('overview of available document collections'), making it highly specific and differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly lists three use cases: getting an overview, finding IDs for subsequent operations, and verifying existence before operations. It also implies when to use alternatives by noting that 'detailed information' is returned, suggesting 'needle_get_collection_details' for more specifics, though it doesn't name alternatives directly. This provides clear, actionable guidance.

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

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