select_instance
Specify which database instance to use for subsequent operations in BetterDB MCP, enabling focused monitoring and management of specific Redis or Valkey instances.
Instructions
Select which instance subsequent tool calls operate on.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instanceId | Yes | The instance ID to select |
Implementation Reference
- packages/mcp/src/index.ts:180-198 (handler)The implementation of the `select_instance` tool, which verifies the instance ID against available instances and sets the global `activeInstanceId` variable.
server.tool( 'select_instance', 'Select which instance subsequent tool calls operate on.', { instanceId: z.string().regex(/^[a-zA-Z0-9_-]+$/, 'Invalid instance ID format').describe('The instance ID to select') }, async ({ instanceId }) => { const data = await apiFetch('/mcp/instances') as { instances: Array<{ id: string; name: string }> }; const found = data.instances.find((inst) => inst.id === instanceId); if (!found) { return { content: [{ type: 'text' as const, text: `Instance '${instanceId}' not found. Use list_instances to see available instances.` }], isError: true, }; } activeInstanceId = instanceId; return { content: [{ type: 'text' as const, text: `Selected instance: ${found.name} (${instanceId})` }], }; }, );