Skip to main content
Glama
hyperspell

hyperspell-mcp

Official
by hyperspell

Get Collection

Retrieve all documents from a specified collection to access and manage your unstructured data through the Hyperspell MCP server.

Instructions

Get a list of all documents in a collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_nameYes

Implementation Reference

  • The handler function for the 'Get Collection' tool. It lists all documents in the specified collection using the Hyperspell API and converts them to Document objects.
    @mcp.tool_or_resource("collection://{collection_name}", name="Get Collection") def get_documents(collection_name: str) -> list[Document]: """Get a list of all documents in a collection""" r = mcp.api.documents.list(collection=collection_name) return Document.from_pydantic(r.items)
  • Pydantic-compatible dataclass defining the structure of Document objects returned by the 'Get Collection' tool.
    class Document(BaseModel): id: int title: str type: str summary: str
  • Custom decorator method used to register the tool or resource for 'Get Collection' (and others), conditionally as tool or resource based on config.
    def tool_or_resource(self, uri: str, name: str | None = None): def decorator(fn: Callable): description = fn.__doc__ if self.config.use_resources: self.resource( uri, name=name, description=description, mime_type="application/json", )(fn) if self.config.use_tools: self.add_tool(fn, name=name, description=description) return fn return decorator

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/hyperspell/hyperspell-mcp'

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