Overview
Theconnection-tree command returns a hierarchical tree of database objects that the host renders as a browsable sidebar. Supports nested structures like databases → schemas → tables → columns.
Command Invocation
ConnectionTreeRequest object
Stdout: JSON-encoded ConnectionTreeResponse object
Timeout: 30 seconds
Required: No - optional command for enhanced browsing UX
Request Parameters
Response Structure
Top-level array of tree nodes. Each node can have nested children.
ConnectionTreeNode Fields
ConnectionTreeAction Fields
Example Implementation
Fromplugins/mysql/main.go:
Request Format (stdin)
Response Format (stdout)
Action Execution Flow
- User right-clicks a node or double-clicks it
- Host shows context menu with non-hidden actions
- User selects an action
- Host calls the plugin’s
execcommand with the action’squerystring - Result is displayed in current or new tab based on
newTabflag
Common Patterns
Default Click Action
Usehidden: true + newTab: true for the primary action triggered by double-clicking a node:
DDL Actions
Provide template queries for creating/dropping objects:Error Handling
- If connection fails, return an empty tree:
{"nodes": []} - Do not write to stderr or exit with non-zero status unless a fatal error occurs
- The host gracefully handles empty trees by showing “No objects found”
Notes
- Tree structure is plugin-defined - SQL databases typically use database → table → column hierarchy
- Document stores might use database → collection hierarchy
- Key-value stores might flatten to a single level or group by namespace
- Action queries are executed via the
execcommand, so use the same query syntax