Hi! 👋 We are doing a big documentation refresh. Help us improve — what's missing or could be better? Let us know! Simply send an email or start a conversation in Google Groups!

Query Tools (/mcp/query)

ProxySQL v4.0.10 advertises the following 29 released tools on /mcp/query. The Required and Optional columns reproduce the released inputSchema: required properties created by the common schema helper are advertised as strings, even for identifiers that the implementation later resolves numerically. Call list_targets first and carry its target_id through discovery, catalog, query, agent, and LLM calls.

MCP query rules are evaluated only for run_sql_readonly and explain_sql; they are not a universal filter for the other 27 tools or for other MCP endpoints. Several catalog, discovery, agent, and LLM tools write mcp_catalog.db, so protect the Query token even when backend SQL is read-only.

Inventory, sampling, SQL, and discovery

ToolRequiredOptionalReleased behavior
list_targetsNoneNoneLists logical targets, descriptions, capabilities, and the default target.
list_schemasNonepage_token (string), page_size (integer), target_id (string)Lists catalog schemas for the selected or default target.
list_tablesschemapage_token (string), page_size (integer), name_filter (string), target_id (string)Lists backend tables for the resolved executable target.
get_constraintsschematable (string)Advertised for compatibility but returns a deprecation error directing callers to catalog.get_relationships.
sample_rowsschema, tablecolumns (string), where (string), order_by (string), limit (integer)Advertised in v4.0.10, but no released execution branch exists; invocation returns Unknown tool.
sample_distinctschema, table, columnwhere (string), limit (integer)Advertised in v4.0.10, but no released execution branch exists; invocation returns Unknown tool.
run_sql_readonlysqlschema (string), target_id (string), max_rows (integer), timeout_sec (integer)Resolves an executable target, applies MCP query rules, rejects non-read-only/dangerous SQL, executes it, and records digest/tool statistics. The direct max_rows and timeout_sec arguments are parsed but not enforced in this release; an applicable query rule can rewrite/block/short-circuit and supply a timeout value.
explain_sqlsqlschema (string), target_id (string)Applies MCP query rules and the same read-only/dangerous-SQL validation, then executes backend EXPLAIN.
suggest_joinsschema, table_atable_b (string), max_candidates (integer)Returns a deprecation error directing callers to catalog.get_relationships.
find_reference_candidatesschema, table, columnmax_tables (integer)Returns a deprecation error directing callers to catalog.get_relationships.
discovery.run_statictarget_idschema_filter (string), notes (string)Runs the protocol-aware static harvester for one executable target and returns its discovery run statistics.

Catalog

ToolRequiredOptionalReleased behavior
catalog.initNonesqlite_path (string)Reports the catalog as initialized; omission uses the handler’s configured database path.
catalog.searchtarget_id, run_id, querylimit (integer), object_type (string), schema_name (string)FTS5 search over discovered objects in one target/run.
catalog.get_objecttarget_id, run_idobject_id (integer), object_key (string), include_definition (boolean), include_profiles (boolean)Fetches one object selected by object_id or object_key.
catalog.list_objectstarget_id, run_idschema_name (string), object_type (string), order_by (string), page_size (integer), page_token (string)Returns a filtered, ordered page of objects.
catalog.get_relationshipstarget_id, run_idobject_id (integer), object_key (string), include_inferred (boolean), min_confidence (number)Returns foreign keys, view dependencies, and optionally inferred relationships for one object.

run_id may be a numeric discovery run or a schema name resolvable within the same target_id. For the exact catalog persistence model and return contracts, see MCP Catalog.

Agent-run tracking

ToolRequiredOptionalReleased behavior
agent.run_starttarget_id, run_id, model_nameprompt_hash (string), budget (object)Starts an LLM-agent run bound to a discovery run.
agent.run_finishagent_run_id, statuserror (string)Finishes an agent run with success/failure status and an optional error.
agent.event_appendagent_run_id, event_type, payloadNoneAppends a trace event. The released schema advertises payload as a required string.

LLM memory and semantic artifacts

ToolRequiredOptionalReleased behavior
llm.summary_upserttarget_id, agent_run_id, run_id, object_id, summaryconfidence (number), status (string), sources (object)Creates or updates the structured semantic summary for an object.
llm.summary_gettarget_id, run_id, object_idagent_run_id (integer), latest (boolean)Retrieves an object’s summary, optionally for one agent run or the latest entry.
llm.relationship_upserttarget_id, agent_run_id, run_id, child_object_id, child_column, parent_object_id, parent_column, confidencerel_type (string), evidence (object)Stores an LLM-inferred relationship with confidence and evidence.
llm.domain_upserttarget_id, agent_run_id, run_id, domain_keytitle (string), description (string), confidence (number)Creates or updates a semantic domain.
llm.domain_set_memberstarget_id, agent_run_id, run_id, domain_key, membersNoneReplaces the domain’s members. The released schema advertises members as a required string.
llm.metric_upserttarget_id, agent_run_id, run_id, metric_key, titledescription (string), domain_key (string), grain (string), unit (string), sql_template (string), depends (object), confidence (number)Creates or updates a metric/KPI definition.
llm.question_template_addtarget_id, run_id, title, question_nl, templateagent_run_id (integer), example_sql (string), related_objects (array), confidence (number)Adds a natural-language question template and associated structured query plan.
llm.note_addtarget_id, agent_run_id, run_id, scope, bodyobject_id (integer), domain_key (string), title (string), tags (array)Stores a durable scoped note.
llm.searchtarget_id, run_idquery (string), limit (integer), include_objects (boolean)Searches LLM artifacts; an empty query lists question templates, while a non-empty query can include complete related-object schemas.

Tool-usage statistics

ToolRequiredOptionalReleased behavior
stats.get_tool_usageNoneNoneReturns in-memory Query-handler invocation counts and timing grouped by endpoint, tool, and schema context.

Use tools/list against the running endpoint to inspect the same registry. SQL/tool usage is also exposed through the MCP Stats tables; rule-hit statistics are documented with MCP configuration tables.