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.
63 lines (62 loc) • 2.07 kB
TypeScript
import { Range } from '../value-objects/roll-range.js';
/**
* Represents an entry in a random table.
*/
export declare class TableEntry {
readonly id: string;
readonly content: string;
readonly weight: number;
readonly range?: Range | undefined;
/**
* Creates a new TableEntry instance.
* @param id Unique identifier for the entry.
* @param content The content of this entry (text, reference to another table, etc.).
* @param weight Probability weight (default: 1).
* @param range Optional range of values this entry corresponds to (e.g., "1-5" on a d20).
*/
constructor(id: string, content: string, weight?: number, range?: Range | undefined);
/**
* Checks if a value is within this entry's range.
* @param value The value to check.
* @returns True if the entry has no range or if the value is within the range, false otherwise.
*/
isInRange(value: number): boolean;
/**
* Checks if this entry's content is a template.
* @returns True if the content contains template references, false otherwise.
*/
isTemplate(): boolean;
/**
* Creates a copy of this entry with updated properties.
* @param updates Object containing the properties to update.
* @returns A new TableEntry instance with updated properties.
*/
update(updates: Partial<Omit<TableEntry, 'id'>>): TableEntry;
/**
* Creates a TableEntry from a plain object.
* @param obj The object to create the entry from.
* @returns A new TableEntry instance.
*/
static fromObject(obj: {
id: string;
content: string;
weight?: number;
range?: {
min: number;
max: number;
};
}): TableEntry;
/**
* Converts this entry to a plain object.
* @returns A plain object representation of this entry.
*/
toObject(): {
id: string;
content: string;
weight: number;
range?: {
min: number;
max: number;
};
};
}