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.
37 lines • 1.01 kB
JavaScript
import { BaseResource } from './resource.js';
/**
* Resource for accessing a list of tables.
*/
export class TablesResource extends BaseResource {
/**
* Creates a new TablesResource 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 'tables://';
}
/**
* Gets the content of the resource.
* @returns The resource content.
*/
async getResourceContent() {
const tables = await this.tableService.listTables();
return {
tables: tables.map(table => ({
id: table.id,
name: table.name,
description: table.description,
entryCount: table.entries.length,
})),
};
}
}
//# sourceMappingURL=tables-resource.js.map