Overview
This node exposes a tool for running read-only SQL queries on a configured MSSQL database via a dedicated MCP server. It is designed to be used as an AI Agent tool, allowing the agent to supply SQL queries dynamically or fall back to a default query. The node formats the query results either as a JSON string or a Markdown table, making it useful for scenarios where automated SQL querying and result formatting are needed, such as data retrieval, reporting, or integration with AI workflows.
Use Case Examples
- An AI agent querying a MSSQL database to retrieve sales data and receive results in JSON format for further processing.
- Generating a Markdown table report of database query results for easy viewing in markdown-supported environments.
Properties
| Name | Meaning |
|---|---|
| Description | Description of the tool and instructions for when the AI agent should call it, including that the SQL statement must be supplied via input. |
| Default SQL Query | An optional fallback SQL statement used when the agent does not provide one explicitly. |
| Result Format | Determines how the tool formats its response for the agent, either as JSON or a Markdown table. |
Output
JSON
sql- The SQL query string that was executed.rows- The resulting rows from the SQL query as an array of objects.
Dependencies
- Requires credentials for connecting to the MCP server and MSSQL database, including server, database, username, password, MCP host, and port.
Troubleshooting
- Error if the tool name contains invalid characters; ensure the tool name starts with a letter or underscore and contains only alphanumeric characters or underscores.
- Error if MCP credentials are missing; ensure the command-based MCP credentials are configured properly.
- Error if no SQL query is provided by the agent and no default SQL query is set; either supply a query or configure a default query.
- Errors from the MCP server call are propagated with descriptive messages; check network connectivity and credential correctness if failures occur.