set_default_connection
Set a specific database instance as the active default connection for BetterDB MCP server operations.
Instructions
Set a connection as the active default for BetterDB.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instanceId | Yes | The instance ID to set as default |
Implementation Reference
- packages/mcp/src/index.ts:293-315 (handler)The implementation of the set_default_connection MCP tool, which sets a BetterDB connection as the default by making an API request.
server.tool( 'set_default_connection', 'Set a connection as the active default for BetterDB.', { instanceId: z.string().regex(/^[a-zA-Z0-9_-]+$/, 'Invalid instance ID format').describe('The instance ID to set as default'), }, async ({ instanceId }) => { try { const data = await apiRequest('POST', `/connections/${encodeURIComponent(instanceId)}/default`); if (isLicenseError(data)) { return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] }; } return { content: [{ type: 'text' as const, text: `Set as default: ${instanceId}` }], }; } catch (err) { return { content: [{ type: 'text' as const, text: err instanceof Error ? err.message : String(err) }], isError: true, }; } }, );