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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
headYes
rowsYes
statusYes
column_metaYes

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
Behavior3/5

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

Discloses the underlying SQL command (`USE`) and return type (TaosSqlResponse), which is helpful. However, with no annotations provided, it fails to disclose critical behavioral traits: whether the switch affects only the current session, persists across subsequent tool calls, or validates the database existence before switching.

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?

Uses structured Python docstring format with clear Args/Returns sections. The Returns section is somewhat redundant given the existence of an output schema, but the overall structure is logical and the purpose statement is appropriately front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While the output schema handles return value documentation, the description lacks crucial context for a state-modifying tool: relationship to sibling query tools (prerequisites?), session scope, and error conditions. Adequate but incomplete for proper orchestration.

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 coverage is 100%, establishing a baseline of 3. The description repeats the parameter description almost verbatim from the schema ('The name of the database to switch to') without adding format constraints, validation rules, or examples beyond what the schema already provides.

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?

States the specific action (switch) and target resource (database) clearly. However, it could better distinguish from 'get_all_dbs' by clarifying this changes the active session context rather than just retrieving information.

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?

No explicit guidance on when to call this versus alternatives, or whether it's required before 'query_taos_db_data'. The agent cannot determine if database switching is mandatory for queries or if queries can specify database names inline.

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

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