Skip to main content
Glama
lensesio

Lenses MCP Server

by lensesio

list_datasets

Retrieve and filter datasets (topics and data sources) from Lenses MCP Server environments with pagination, search, and sorting options.

Instructions

Retrieves a paginated list of datasets (topics and other data sources).

Args: environment: The environment name. page: Page number (default: 1). page_size: Items per page (default: 25). search: Search keyword for dataset, fields and description. connections: List of connection names to filter by. tags: List of tag names to filter by. sort_field: Field to sort results by. sort_order: Sorting order - "asc" or "desc" (default: "asc"). include_system: Include system entities (default: False). search_fields: Search field names/documentation (default: True). schema_format: Schema format filter for SchemaRegistrySubject. has_records: Filter based on whether dataset has records. is_compacted: Filter based on compacted status (Kafka only).

Returns: Paginated list of datasets with source types.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentYes
pageNo
page_sizeNo
searchNo
connectionsNo
tagsNo
sort_fieldNo
sort_orderNoasc
include_systemNo
search_fieldsNo
schema_formatNo
has_recordsNo
is_compactedNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'list_datasets' tool. It is decorated with @mcp.tool(), which registers it with the MCP server when register_topics(mcp) is called. The function builds a query string from parameters and makes a GET request to the API endpoint to retrieve paginated datasets.
    @mcp.tool()
    async def list_datasets(
        environment: str,
        page: int = 1,
        page_size: int = 25,
        search: Optional[str] = None,
        connections: Optional[List[str]] = None,
        tags: Optional[List[str]] = None,
        sort_field: Optional[str] = None,
        sort_order: str = "asc",
        include_system: bool = False,
        search_fields: bool = True,
        schema_format: Optional[str] = None,
        has_records: Optional[bool] = None,
        is_compacted: Optional[bool] = None
    ) -> Dict[str, Any]:
        """
        Retrieves a paginated list of datasets (topics and other data sources).
        
        Args:
            environment: The environment name.
            page: Page number (default: 1).
            page_size: Items per page (default: 25).
            search: Search keyword for dataset, fields and description.
            connections: List of connection names to filter by.
            tags: List of tag names to filter by.
            sort_field: Field to sort results by.
            sort_order: Sorting order - "asc" or "desc" (default: "asc").
            include_system: Include system entities (default: False).
            search_fields: Search field names/documentation (default: True).
            schema_format: Schema format filter for SchemaRegistrySubject.
            has_records: Filter based on whether dataset has records.
            is_compacted: Filter based on compacted status (Kafka only).
        
        Returns:
            Paginated list of datasets with source types.
        """
        params = {
            "page": page,
            "pageSize": page_size,
            "sortOrder": sort_order,
            "includeSystemEntities": include_system,
            "searchFields": search_fields
        }
        
        if search:
            params["search"] = search
        if connections:
            params["connections"] = connections
        if tags:
            params["tags"] = tags
        if sort_field:
            params["sortField"] = sort_field
        if schema_format:
            params["schemaFormat"] = schema_format
        if has_records is not None:
            params["hasRecords"] = has_records
        if is_compacted is not None:
            params["isCompacted"] = is_compacted
        
        # Build query string
        query_params = []
        for key, value in params.items():
            if isinstance(value, list):
                for item in value:
                    query_params.append(f"{key}={item}")
            else:
                query_params.append(f"{key}={value}")
        
        query_string = "&".join(query_params)
        endpoint = f"/api/v1/environments/{environment}/proxy/api/v1/datasets?{query_string}"
        
        return await api_client._make_request("GET", endpoint)
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool is for retrieval (read-only) and mentions pagination, but doesn't cover important aspects like rate limits, authentication requirements, error conditions, or what happens with invalid parameters. The 'Returns' section mentions paginated results with source types, but lacks detail on response structure.

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 with clear sections for purpose, arguments, and returns. While comprehensive, it's appropriately sized for a tool with 13 parameters. Every sentence earns its place, though the parameter explanations could be slightly more concise.

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 complexity (13 parameters, no annotations) and the presence of an output schema, the description is reasonably complete. It explains the tool's purpose, documents all parameters thoroughly, and mentions the return type. However, it lacks behavioral context like error handling or performance characteristics that would be helpful for a complex retrieval tool.

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

Parameters5/5

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

With 0% schema description coverage and 13 parameters, the description provides comprehensive parameter documentation in the 'Args' section, explaining each parameter's purpose, defaults, and constraints. This fully compensates for the lack of schema descriptions and adds significant value beyond the basic schema.

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 tool's purpose with specific verb ('Retrieves') and resource ('paginated list of datasets'), and distinguishes it from siblings by specifying it's for datasets (topics and other data sources) rather than topics alone or other resources. This differentiates it from tools like list_topics or list_environments.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like get_dataset (for single dataset details) or list_topics (for topics only), nor does it specify prerequisites or contextual constraints beyond the required environment parameter.

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/lensesio/lenses-mcp'

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