Files
mcp-code/commands/list-usernames.ts
2025-03-29 09:34:43 +00:00

24 lines
900 B
TypeScript

import { Command } from 'commander';
import { listUsernames } from '../logic/list_usernames.js';
export function registerListUsernamesCommand(program: Command): void {
program
.command('list-usernames')
.description('List all usernames in the database')
.action(async () => {
try {
const result = await listUsernames();
// Extract text content from the response
if (result.content && result.content.length > 0) {
const textContent = result.content.find(item => item.type === 'text');
if (textContent) {
console.log(textContent.text);
}
}
} catch (error) {
console.error("Error executing list-usernames command:", error);
process.exit(1);
}
});
}