UNPKG

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.

61 lines (60 loc) 2.4 kB
import { RandomTable, TableEntry } from '../../domain/index.js'; import { TableService } from '../../ports/index.js'; import { CreateTableUseCase } from '../create-table-use-case.js'; import { GetTableUseCase } from '../get-table-use-case.js'; import { ListTablesUseCase } from '../list-tables-use-case.js'; import { UpdateTableUseCase } from '../update-table-use-case.js'; /** * Implementation of the TableService interface. */ export declare class TableServiceImpl implements TableService { private readonly createTableUseCase; private readonly getTableUseCase; private readonly listTablesUseCase; private readonly updateTableUseCase; /** * Creates a new TableServiceImpl instance. * @param createTableUseCase The use case for creating tables. * @param getTableUseCase The use case for getting tables. * @param listTablesUseCase The use case for listing tables. * @param updateTableUseCase The use case for updating tables. */ constructor(createTableUseCase: CreateTableUseCase, getTableUseCase: GetTableUseCase, listTablesUseCase: ListTablesUseCase, updateTableUseCase: UpdateTableUseCase); /** * Creates a new table. * @param name Table name. * @param description Optional description. * @param entries Optional initial entries. * @returns The ID of the created table. */ createTable(name: string, description?: string, entries?: TableEntry[]): Promise<string>; /** * Gets a table by its ID. * @param id The ID of the table to get. * @returns The table, or null if not found. */ getTable(id: string): Promise<RandomTable | null>; /** * Updates an existing table. * @param id The ID of the table to update. * @param updates Object containing the updates to apply. */ updateTable(id: string, updates: { name?: string; description?: string; entries?: { add?: TableEntry[]; update?: { id: string; updates: Partial<Omit<TableEntry, 'id'>>; }[]; remove?: string[]; }; }): Promise<void>; /** * Lists tables based on optional filter criteria. * @param filter Optional filter criteria. * @returns An array of tables matching the filter. */ listTables(filter?: Record<string, unknown>): Promise<RandomTable[]>; }