add_connection
Add a new Valkey or Redis connection to BetterDB for observability and monitoring. Optionally set it as the active default connection.
Instructions
Add a new Valkey/Redis connection to BetterDB. Optionally set it as the active default.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Display name for the connection | |
| host | Yes | Hostname or IP address | |
| port | No | Port number | |
| username | No | ACL username (default: "default") | |
| password | No | Auth password | |
| setAsDefault | No | Set this connection as the active default |
Implementation Reference
- packages/mcp/src/index.ts:202-229 (handler)Implementation of the 'add_connection' MCP tool, which makes a POST request to the API to register a new connection.
server.tool( 'add_connection', 'Add a new Valkey/Redis connection to BetterDB. Optionally set it as the active default.', { name: z.string().describe('Display name for the connection'), host: z.string().describe('Hostname or IP address'), port: z.number().int().min(1).max(65535).default(6379).describe('Port number'), username: z.string().optional().describe('ACL username (default: "default")'), password: z.string().optional().describe('Auth password'), setAsDefault: z.boolean().optional().describe('Set this connection as the active default'), }, async (params) => { try { const data = await apiRequest('POST', '/connections', params) as { id: string }; if (isLicenseError(data)) { return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] }; } return { content: [{ type: 'text' as const, text: `Added connection: ${params.name} (${data.id})` }], }; } catch (err) { return { content: [{ type: 'text' as const, text: err instanceof Error ? err.message : String(err) }], isError: true, }; } }, );