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.
51 lines (50 loc) • 1.83 kB
TypeScript
import { TemplateReference } from './template-reference.js';
/**
* Represents a template string that can contain references to other tables.
* References are in the format {{reference-title::table-id::table-name::roll-number::separator}}
*/
export declare class RollTemplate {
readonly template: string;
/**
* Regular expression to match template references.
* Matches anything between {{ and }}, including empty references.
*/
private static readonly REFERENCE_REGEX;
/**
* Maximum depth for template resolution to prevent infinite loops.
*/
static readonly MAX_RESOLUTION_DEPTH = 5;
/**
* Creates a new RollTemplate instance.
* @param template The template string
*/
constructor(template: string);
/**
* Checks if a string contains template references.
* @param text The string to check
* @returns True if the string contains template references, false otherwise
*/
static isTemplate(text: string): boolean;
/**
* Extracts all template references from the template string.
* @returns An array of TemplateReference objects
*/
extractReferences(): TemplateReference[];
/**
* Replaces a reference in the template with a value.
* @param reference The reference to replace
* @param value The value to replace it with
* @returns A new RollTemplate with the reference replaced
*/
replaceReference(reference: TemplateReference, value: string): RollTemplate;
/**
* Checks if the template still contains unresolved references.
* @returns True if the template contains unresolved references, false otherwise
*/
hasUnresolvedReferences(): boolean;
/**
* Returns the template string.
* @returns The template string
*/
toString(): string;
}