Skip to main content
Glama
caretdev

InterSystems IRIS MCP Server

execute_sql

Execute SQL queries to retrieve or manipulate data in InterSystems IRIS databases. Use this tool to run queries with optional parameters for database operations.

Instructions

Execute an SQL query on the Server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
paramsNo

Implementation Reference

  • Registers the execute_sql tool with the MCP server using the @server.tool decorator.
    @server.tool(description="Execute an SQL query on the Server")
  • The core handler function for the execute_sql tool. It takes a SQL query and optional parameters, executes it on the IRIS database connection from the context, limits results to 100 rows, and returns the results as a list of TextContent.
    async def execute_sql( query: str, ctx: Context, params: list[str] = [] ) -> list[types.TextContent]: # params = arguments.get("params", []) logger.info(f"Executing SQL query: {query}") conn = ctx.db with conn.cursor() as cursor: cursor.execute(query, params) # limit by 100 rows rows = cursor.fetchall()[:100] return [types.TextContent(type="text", text=str(rows))]

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/caretdev/mcp-server-iris'

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