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.
36 lines • 1.01 kB
JavaScript
import { BaseResource } from './resource.js';
/**
* Resource for accessing all roll templates.
*/
export class TemplatesResource extends BaseResource {
/**
* Creates a new TemplatesResource 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 'templates';
}
/**
* Gets the content of the resource.
* @returns The resource content.
*/
async getResourceContent() {
const templates = await this.templateService.listTemplates();
return {
templates: templates.map(template => ({
id: template.id,
name: template.name,
description: template.description,
})),
};
}
}
//# sourceMappingURL=templates-resource.js.map