Skip to main content
Glama

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
NameRequiredDescriptionDefault
instanceIdYesThe instance ID to select

Implementation Reference

  • 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})` }],
        };
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BetterDB-inc/monitor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server