Skip to main content
Glama

steampipe_query

Query cloud infrastructure, SaaS, APIs, and code using SQL to analyze data from multiple sources with PostgreSQL syntax.

Instructions

Query cloud infrastructure, SaaS, APIs, code and more with SQL.

Queries are read-only and must use PostgreSQL syntax.

For best performance: limit columns requested, use materialized CTEs instead of joins. Trust the search path unless sure you need to specify a schema.

Check available tables and columns before querying using steampipe_table_list and steampipe_table_show.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesThe SQL query to execute. Must use PostgreSQL syntax and be read-only.

Implementation Reference

  • The main handler function for the steampipe_query tool. It executes the provided SQL query using DatabaseService.executeQuery and returns the results as JSON string or an error message.
    handler: async (db: DatabaseService | undefined, args: { sql: string }) => { if (!db) { return { content: [{ type: "text", text: "Database not available" }], isError: true, }; } try { const rows = await db.executeQuery(args.sql); return { content: [{ type: "text", text: JSON.stringify(rows) }], isError: false }; } catch (error) { logger.error('Error executing query:', error); return { content: [{ type: "text", text: error instanceof Error ? error.message : String(error) }], isError: true }; } }
  • The input schema defining the required 'sql' parameter as a string for the SQL query.
    inputSchema: { type: "object", properties: { sql: { type: "string", description: "The SQL query to execute. Must use PostgreSQL syntax and be read-only." } }, required: ["sql"], additionalProperties: false },
  • Registration of the steampipe_query tool in the central tools export object, which is used by setupTools to register with the MCP server.
    export const tools = { steampipe_query: queryTool as DbTool, steampipe_table_list: tableListTool as DbTool, steampipe_table_show: tableShowTool as DbTool, steampipe_plugin_list: pluginListTool as DbTool, steampipe_plugin_show: pluginShowTool as DbTool, } as const;

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/turbot/steampipe-mcp'

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