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.
55 lines (54 loc) • 1.96 kB
TypeScript
import { RollTemplateEntity } from '../../../domain/entities/roll-template-entity.js';
import { RollTemplateRepository } from '../../../ports/secondary/roll-template-repository.js';
/**
* File-based implementation of the RollTemplateRepository interface.
* Stores templates as JSON files in a specified directory.
*/
export declare class FileRollTemplateRepository implements RollTemplateRepository {
private dataDir;
/**
* Creates a new FileRollTemplateRepository instance.
* @param dataDir The directory where template files will be stored.
*/
constructor(dataDir: string);
/**
* Initializes the repository by ensuring the data directory exists.
*/
initialize(): Promise<void>;
/**
* Gets the file path for a template ID.
* @param id The template ID.
* @returns The file path.
*/
private getFilePath;
/**
* Saves a template to the repository.
* @param template The template to save.
* @returns The ID of the saved template.
*/
save(template: RollTemplateEntity): Promise<string>;
/**
* Gets a template by its ID.
* @param id The ID of the template to get.
* @returns The template, or null if not found.
*/
getById(id: string): Promise<RollTemplateEntity | null>;
/**
* Updates an existing template.
* @param template The updated template.
* @throws Error if the template does not exist.
*/
update(template: RollTemplateEntity): Promise<void>;
/**
* Lists templates based on optional filter criteria.
* @param filter Optional filter criteria.
* @returns An array of templates matching the filter.
*/
list(filter?: Record<string, unknown>): Promise<RollTemplateEntity[]>;
/**
* Deletes a template by its ID.
* @param id The ID of the template to delete.
* @throws Error if the template does not exist.
*/
delete(id: string): Promise<void>;
}