Skip to main content
Glama

execute_sql

Execute SQL queries on Kafka topics across multiple clusters using Lenses.io WebSocket API to manage, explore, transform, and join streaming data.

Instructions

Executes SQL statements/queries using Lenses WebSocket API.

Args: environment: The environment name. sql: The SQL statement/query to execute.

Returns: A list of MessageRecord objects representing the result of the SQL query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentYes
sqlYes

Implementation Reference

  • The handler function for the 'execute_sql' tool, decorated with @mcp.tool(). It executes the provided SQL query in the specified Lenses environment using the WebSocket API.
    @mcp.tool() async def execute_sql(environment: str, sql: str) -> List[Dict[str, Any]]: """ Executes SQL statements/queries using Lenses WebSocket API. Args: environment: The environment name. sql: The SQL statement/query to execute. Returns: A list of MessageRecord objects representing the result of the SQL query. """ endpoint = f"/api/v1/environments/{environment}/proxy/api/ws/v2/sql/execute" return await websocket_client._make_request(endpoint=endpoint, sql=sql)
  • Registers the SQL tools (including execute_sql) by calling register_sql(mcp) in the main MCP server setup.
    register_sql(mcp)
  • Imports the register_sql function used to register the execute_sql tool.
    from tools.sql import register_sql

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

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