Skip to main content
Glama

steampipe_query

Query cloud infrastructure, SaaS, APIs, and code with PostgreSQL syntax. Execute read-only SQL queries to access and analyze data efficiently. Use provided tools to explore available tables and columns before querying.

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 that executes the SQL query using DatabaseService.executeQuery and returns the results as JSON 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 }; } }
  • Input schema specifying the required 'sql' string parameter for the steampipe_query tool.
    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 },
  • The steampipe_query tool is registered in the exported 'tools' object, which is used by the MCP server handlers.
    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;

Other Tools

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

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