Skip to main content
Glama

warden_db_query

Execute SQL queries in Magento databases within Warden-managed development environments to manage and retrieve data.

Instructions

Run a SQL query in the Warden database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to the project directory
queryYesSQL query to execute
databaseNoDatabase name (optional, defaults to magento)magento

Implementation Reference

  • The main handler function that implements the 'warden_db_query' tool. It destructures the arguments, builds a 'warden env exec db mysql ...' command to execute the provided SQL query in the specified database (default 'magento'), and calls executeWardenCommand to run it and format the response.
    async runDbQuery(args) { const { project_path, query, database = "magento" } = args; const wardenCommand = [ "env", "exec", "-T", "db", "mysql", "-u", "root", "-pmagento", database, "-e", query, ]; return await this.executeWardenCommand( project_path, wardenCommand, `Running database query in ${database}`, ); }
  • Input schema definition for the warden_db_query tool, specifying required project_path and query parameters, and optional database (defaults to 'magento').
    inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to the project directory", }, query: { type: "string", description: "SQL query to execute", }, database: { type: "string", description: "Database name (optional, defaults to magento)", default: "magento", }, }, required: ["project_path", "query"], },
  • server.js:100-122 (registration)
    Tool registration entry in the ListToolsRequestSchema handler's tools array, defining the name, description, and input schema for 'warden_db_query'.
    { name: "warden_db_query", description: "Run a SQL query in the Warden database", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to the project directory", }, query: { type: "string", description: "SQL query to execute", }, database: { type: "string", description: "Database name (optional, defaults to magento)", default: "magento", }, }, required: ["project_path", "query"], }, },
  • server.js:331-332 (registration)
    Handler dispatch registration in the CallToolRequestSchema switch statement, mapping 'warden_db_query' to the runDbQuery method.
    case "warden_db_query": return await this.runDbQuery(request.params.arguments);

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/run-as-root/warden-mcp-server'

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