Skip to main content
Glama

list_databases

Explore database hierarchies and access flight data warehouses in the EMS system. Navigate through databases and subgroups to locate flight records and analytics resources.

Instructions

Navigate the database hierarchy. Call without group_id for root level.

The "FDW Flights" database (Flight Data Warehouse) contains flight records.

Args: ems_system_id: EMS system ID (from list_ems_systems). group_id: Group ID to navigate into (omit for root).

Returns: Databases and subgroups at the specified level.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ems_system_idYes
group_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main implementation of list_databases tool. This async function navigates the database hierarchy, accepts ems_system_id and optional group_id parameters, fetches database groups from the EMS API with caching support, and returns formatted results showing databases and subgroups.
    @mcp.tool
    async def list_databases(
        ems_system_id: int,
        group_id: str | None = None,
    ) -> str:
        """Navigate the database hierarchy. Call without group_id for root level.
    
        The "FDW Flights" database (Flight Data Warehouse) contains flight records.
    
        Args:
            ems_system_id: EMS system ID (from list_ems_systems).
            group_id: Group ID to navigate into (omit for root).
    
        Returns:
            Databases and subgroups at the specified level.
        """
        client = get_client()
    
        cache_key = make_cache_key("database_group", ems_system_id, group_id or "root")
        cached = await database_cache.get(cache_key)
        if cached is not None:
            logger.debug("Using cached database group: %s", cache_key)
            return _format_database_group(cached)
    
        try:
            path = f"/api/v2/ems-systems/{ems_system_id}/database-groups"
            if group_id:
                path += f"?groupId={group_id}"
    
            group = await client.get(path)
            await database_cache.set(cache_key, group)
            return _format_database_group(group)
        except EMSNotFoundError:
            return f"Error: Database group not found. Verify ems_system_id={ems_system_id} is valid."
        except EMSAPIError as e:
            return f"Error listing databases: {e.message}"
  • MCP tool registration decorator. The @mcp.tool decorator on line 898 registers list_databases as an available MCP tool with the FastMCP server instance.
    async def list_databases(
  • Helper function that formats the database group response for display. This function creates a human-readable string showing group name, databases with their IDs and descriptions, and subgroups.
    def _format_database_group(group: dict[str, Any]) -> str:
        """Format database group response for display."""
        lines = []
    
        group_name = group.get("name", "Root")
        group_id = group.get("id", "[none]")
        lines.append(f"Group: {group_name} (ID: {group_id})")
    
        # Format databases
        databases = group.get("databases", [])
        if databases:
            lines.append(f"\nDatabases ({len(databases)}):")
            for db in databases:
                db_id = db.get("id", "?")
                # Handle both root level (name/description) and nested (pluralName/singularName)
                db_name = db.get("name") or db.get("pluralName") or db.get("singularName", "Unknown")
                desc = db.get("description", "")
                # Annotate entity-type-group IDs that require further navigation
                if "[entity-type-group]" in str(db_id):
                    note = " [NOTE: this is a group ID - navigate deeper with list_databases]"
                    lines.append(f"  - {db_name} (ID: {db_id}){note}")
                elif desc:
                    lines.append(f"  - {db_name}: {desc}")
                else:
                    lines.append(f"  - {db_name}")
    
        # Format subgroups
        groups = group.get("groups", [])
        if groups:
            lines.append(f"\nSubgroups ({len(groups)}):")
            for g in groups:
                g_id = g.get("id", "?")
                g_name = g.get("name", "Unknown")
                lines.append(f"  - {g_name} (ID: {g_id})")
    
        if not databases and not groups:
            lines.append("\n(Empty group)")
    
        if databases:
            lines.append(
                "\nUse database names directly in find_fields, query_database, etc."
            )
    
        return "\n".join(lines)
  • Tool module exports. This section imports list_databases from the discovery module and re-exports it as part of the tools package's public API.
    from ems_mcp.tools.discovery import (
        find_fields,
        get_field_info,
        get_result_id,
        list_databases,
        list_ems_systems,
        search_analytics,
    )
  • Server module imports. The server imports ems_mcp.tools.discovery (line 129) which triggers the registration of list_databases via the @mcp.tool decorator when the module loads.
    # Import tools and resources to register them with the mcp instance
    # This must happen after mcp is created
    import ems_mcp.tools.assets  # noqa: E402, F401
    import ems_mcp.tools.discovery  # noqa: E402, F401
    import ems_mcp.tools.query  # noqa: E402, F401
    import ems_mcp.prompts  # noqa: E402, F401
    import ems_mcp.resources  # noqa: E402, F401
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. It discloses the hierarchical navigation behavior and mentions the 'FDW Flights' database example, which adds context. However, it doesn't cover important behavioral aspects like pagination, rate limits, authentication needs, error conditions, or whether this is a read-only operation (though implied by 'navigate').

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 appropriately sized with three focused paragraphs: purpose/usage, example database, and parameter/return explanations. Each sentence earns its place, though the 'FDW Flights' example could be more integrated. The structure is logical with front-loaded navigation guidance.

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 moderate complexity (2 parameters, hierarchical navigation), no annotations, but with an output schema, the description is reasonably complete. It covers purpose, usage, parameters, and return scope. The output schema handles return values, so the description appropriately focuses on navigation behavior rather than output details.

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

Parameters4/5

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

With 0% schema description coverage, the description compensates well by explaining both parameters: 'ems_system_id: EMS system ID (from list_ems_systems)' and 'group_id: Group ID to navigate into (omit for root).' It adds meaningful context about parameter relationships and sources, though it doesn't provide format details or constraints beyond what's implied.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 as 'Navigate the database hierarchy' with specific guidance on root vs. subgroup navigation. It distinguishes from siblings by focusing on hierarchy navigation rather than querying (query_database) or searching (search_analytics). However, it doesn't explicitly contrast with list_ems_systems which might be related.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool: 'Call without group_id for root level' and 'Group ID to navigate into (omit for root).' It implies usage for exploring database structure rather than querying content. However, it doesn't explicitly state when NOT to use it or name specific alternatives among siblings.

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/mattsq/ems-mcp'

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