random-tables-mcp
Version:
An MCP (Model Context Protocol) server for managing and rolling on random-table assets used in tabletop RPGs. Create, update, and roll on random tables with support for nested tables, weighted entries, and range-based results.
26 lines • 698 B
JavaScript
/**
* Use case for getting a random table by ID.
*/
export class GetTableUseCase {
/**
* Creates a new GetTableUseCase instance.
* @param repository The table repository to use.
*/
constructor(repository) {
this.repository = repository;
}
/**
* Executes the use case.
* @param id The ID of the table to get.
* @returns The table, or null if not found.
*/
async execute(id) {
// Validate inputs
if (!id) {
throw new Error('Table ID is required');
}
// Get the table from the repository
return await this.repository.getById(id);
}
}
//# sourceMappingURL=get-table-use-case.js.map