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.

34 lines 968 B
import { BaseResource } from './resource.js'; /** * Resource for accessing a specific table. */ export class TableResource extends BaseResource { /** * Creates a new TableResource instance. * @param tableService The table service to use. */ constructor(tableService) { super(); this.tableService = tableService; } /** * Gets the URI pattern for this resource. * @returns The URI pattern. */ getResourceUriPattern() { return 'table://{tableId}'; } /** * Gets the content of the resource. * @param params The resource parameters. * @returns The resource content. */ async getResourceContent(params) { const table = await this.tableService.getTable(params.tableId); if (!table) { throw new Error(`Table with ID ${params.tableId} not found`); } return table.toObject(); } } //# sourceMappingURL=table-resource.js.map