anythingmcp-query-a-database
Answer questions from a SQL or MongoDB database connected to AnythingMCP (PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SAP HANA, SQLite, MongoDB) with small, read-only queries. Use when the user asks for figures, lists or reports that live in a company database, or says "query the database", "run SQL" or "look it up in the tables". Reads the schema first and never changes data without the user's approval.星标0
复刻0
关注0
更新时间2026-11-06 15:26:18
Use this skill when the answer is in a database the user's AnythingMCP workspace connected.
- Call
anythingmcp_list_connectorsand pick the database connector. If there is none, continue with theanythingmcp-connect-a-systemskill (search for "postgres", "mysql", "mssql", "oracle" or "mongodb"). - Read
anythingmcp_get_workspace_guidefor that connector. Workspace notes often say which tables matter and what the columns mean. - Find its tools with
anythingmcp_search_tools(connector set, query "database"). A database connector hasget_database_schema,get_example_queriesandexecute_query, sometimes with a prefix such aserp_sql_execute_query. - Run the schema tool once with
anythingmcp_run_read_tool. Use only the table and column names it returns. Run the examples tool to get the dialect right (TOP 10orLIMIT 10, quoting, date literals). - Call
anythingmcp_describe_toolon the query tool and checkaccess:read: the connector is read-only and accepts only SELECT. Run it withanythingmcp_run_read_tool.write: the connector accepts writes. Show the user every query and get their approval before eachanythingmcp_run_write_toolcall, even for a SELECT.
- Keep queries small: name the columns you need, filter, aggregate in SQL and limit the rows. Results stop at 1,000 rows. When you are unsure about size, count first or read 10 rows.
- On MongoDB the query is a JSON string:
{"collection": "orders", "filter": {"status": "open"}, "projection": {"_id": 0, "number": 1}, "sort": {"date": -1}, "limit": 10}. - Answer with the figures, the query you ran in a code block, and the tables it read. Say so when a result reached the row limit.
Do not:
- run INSERT, UPDATE, DELETE, MERGE or DDL unless the user asked for that change, saw the exact statement and confirmed it;
- run DROP, TRUNCATE, GRANT or similar statements at all;
- guess table or column names, or run
SELECT *on a large table without a limit; - try to reach a table the database refused through another table or view: the workspace blocked it on purpose.
The user's explicit request always takes priority over these steps, but never over the confirmation rule for writes.