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.
46 lines (45 loc) • 1.49 kB
TypeScript
/**
* Interface for MCP resources.
* @template TParams - The type of parameters extracted from the URI
* @template TContent - The type of content returned by the resource
*/
export interface Resource<TParams = unknown, TContent = unknown> {
/**
* Gets the URI pattern for this resource.
* @returns The URI pattern.
*/
getUriPattern(): string;
/**
* Gets the content of the resource.
* @param params The resource parameters extracted from the URI.
* @returns The resource content.
*/
getContent(params: TParams): Promise<TContent>;
}
/**
* Base class for MCP resources.
*/
export declare abstract class BaseResource<TParams = unknown, TContent = unknown> implements Resource<TParams, TContent> {
/**
* Gets the URI pattern for this resource.
* @returns The URI pattern.
*/
getUriPattern(): string;
/**
* Gets the URI pattern for this resource.
* @returns The URI pattern.
*/
protected abstract getResourceUriPattern(): string;
/**
* Gets the content of the resource.
* @param params The resource parameters extracted from the URI.
* @returns The resource content.
*/
getContent(params: TParams): Promise<TContent>;
/**
* Gets the content of the resource.
* @param params The resource parameters extracted from the URI.
* @returns The resource content.
*/
protected abstract getResourceContent(params: TParams): Promise<TContent>;
}