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.

39 lines 1.16 kB
import { BaseResource } from './resource.js'; /** * Resource for accessing a specific roll template. */ export class TemplateResource extends BaseResource { /** * Creates a new TemplateResource instance. * @param templateService The template service to use. */ constructor(templateService) { super(); this.templateService = templateService; } /** * Gets the URI pattern for this resource. * @returns The URI pattern. */ getResourceUriPattern() { return 'template://{id}'; } /** * Gets the content of the resource. * @param params The resource parameters. * @returns The resource content. */ async getResourceContent(params) { const template = await this.templateService.getTemplate(params.id); if (!template) { throw new Error(`Template with ID ${params.id} not found`); } return { id: template.id, name: template.name, description: template.description, template: template.template.toString(), }; } } //# sourceMappingURL=template-resource.js.map