Skip to main content
Glama
Abeautifulsnow

TDengine Query MCP Server

switch_db

Change the active database in TDengine to execute queries on different datasets. Specify the target database name to switch context for subsequent operations.

Instructions

Switch to the specified database.

    Args:
        db_name (str): The name of the database to switch to.

    Returns:
        TaosSqlResponse: The result of the `USE` command.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
db_nameYesThe name of the database to switch to

Implementation Reference

  • The handler function `switch_db` executes the `USE {db_name};` SQL command via the TDengine client.
    @mcp.tool(name="switch_db")
    def switch_db(
        ctx: Context,
        db_name: str = Field(
            description="The name of the database to switch to"
        ),
    ) -> TaosSqlResponse:
        """Switch to the specified database.
    
        Args:
            db_name (str): The name of the database to switch to.
    
        Returns:
            TaosSqlResponse: The result of the `USE` command.
        """
    
        taos = ctx.request_context.lifespan_context.client
        result = taos.execute_sql(f"USE {db_name};")
    
        return result

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/Abeautifulsnow/tdengine-mcp'

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