Install
openclaw skills install middleware-queryNatural-language read-only querying for MySQL, Redis, and MongoDB with explicit connection configuration (host, port, username, password), guarded query planning, and deterministic script executors. Use when users ask to query local databases/middleware in natural language, inspect Redis keys/values, run Mongo filters/aggregations, or retrieve SQL data safely.
openclaw skills install middleware-queryImplement natural-language query workflows with strict safety controls.
Require all connection parameters explicitly for each datasource:
hostportusernamepassworddatabase (MySQL/Mongo), db (Redis logical DB)Store connection profiles in scripts/connections.json (or provide env vars) before execution.
Use scripts/connections.example.json as a template and keep real connections.json local-only (gitignored).
Prefer middleware-list config with env/alias entries, e.g. {"redis":[{"env":"local","alias":"main",...}]} and use profiles like redis.local or redis.main.
Always keep operations read-only:
SELECT, WITH, EXPLAIN SELECT onlyGET, MGET, HGET, HGETALL, SMEMBERS, ZRANGE, SCAN, TTL, TYPEfind, count_documents, aggregate with read-only stagesReject write/dangerous operations.
Use scripts under scripts/:
nl_query.py (single command entry: NL -> plan -> guard -> execute)planner_llm.py (LLM NL -> plan JSON with retry repair)plan_schema.py + references/plan-schema.json (JSON Schema validation)router_nl.py (rule-based fallback)planner_guard.py (semantic guard)execute_plan.py (validated plan execution)query_sql.pyquery_redis.pyquery_mongo.pyPass validated parameters; never execute free-form shell commands for database access.
Return:
Priority order:
references/config.md)scripts/connections.jsonFail with clear error if any required field is missing.
Read when needed:
references/config.md: connection and env conventionsreferences/safety-policy.md: guardrails and denylistreferences/examples.md: common command examples