Skip to main content
Glama

Roller Derby Rules MCP Server

by Golrigames

search_rules

Find specific Roller Derby rules by entering keywords to locate relevant sections on gameplay, penalties, scoring, and officiating.

Instructions

Search Roller Derby rules by keyword

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • Handler function that searches for the query in either the complete rules file or a specific section, providing matching lines with context, and returns JSON results or no results message.
    async (args) => { const query = args.query.toLowerCase(); const searchSection = args.section || "all"; let results = []; if (searchSection === "all") { // Search in complete file const content = await fs.readFile(COMPLETE_FILE, "utf-8"); const lines = content.split("\n"); lines.forEach((line, index) => { if (line.toLowerCase().includes(query)) { // Add context (line before and after) const context = lines .slice(Math.max(0, index - 1), Math.min(lines.length, index + 2)) .join("\n"); results.push({ line: index + 1, context: context, }); } }); } else { // Search in a specific section const filename = sectionMap[searchSection]; if (filename) { const filePath = path.join(SECTIONS_DIR, filename); const content = await fs.readFile(filePath, "utf-8"); const lines = content.split("\n"); lines.forEach((line, index) => { if (line.toLowerCase().includes(query)) { const context = lines .slice(Math.max(0, index - 1), Math.min(lines.length, index + 2)) .join("\n"); results.push({ section: searchSection, line: index + 1, context: context, }); } }); } } return { content: [ { type: "text", text: results.length > 0 ? JSON.stringify(results, null, 2) : `No results found for "${args.query}"`, }, ], }; }
  • Input schema for the search_rules tool, requiring a 'query' string and optionally a 'section' from predefined enums.
    type: "object", properties: { query: { type: "string", description: "The search term to look for in the rules", }, section: { type: "string", description: "Specific section to search in (optional)", enum: [ "introduction", "parametres", "le-jeu", "score", "penalites", "arbitrage", "all", ], }, }, required: ["query"], },
  • index.js:183-268 (registration)
    Registration of the search_rules tool on the MCP server, including name, description, input schema, and handler reference.
    server.registerTool( "search_rules", { description: "Search Roller Derby rules by keyword", inputSchema: { type: "object", properties: { query: { type: "string", description: "The search term to look for in the rules", }, section: { type: "string", description: "Specific section to search in (optional)", enum: [ "introduction", "parametres", "le-jeu", "score", "penalites", "arbitrage", "all", ], }, }, required: ["query"], }, }, async (args) => { const query = args.query.toLowerCase(); const searchSection = args.section || "all"; let results = []; if (searchSection === "all") { // Search in complete file const content = await fs.readFile(COMPLETE_FILE, "utf-8"); const lines = content.split("\n"); lines.forEach((line, index) => { if (line.toLowerCase().includes(query)) { // Add context (line before and after) const context = lines .slice(Math.max(0, index - 1), Math.min(lines.length, index + 2)) .join("\n"); results.push({ line: index + 1, context: context, }); } }); } else { // Search in a specific section const filename = sectionMap[searchSection]; if (filename) { const filePath = path.join(SECTIONS_DIR, filename); const content = await fs.readFile(filePath, "utf-8"); const lines = content.split("\n"); lines.forEach((line, index) => { if (line.toLowerCase().includes(query)) { const context = lines .slice(Math.max(0, index - 1), Math.min(lines.length, index + 2)) .join("\n"); results.push({ section: searchSection, line: index + 1, context: context, }); } }); } } return { content: [ { type: "text", text: results.length > 0 ? JSON.stringify(results, null, 2) : `No results found for "${args.query}"`, }, ], }; } );

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Golrigames/RollerDerbyRulesMcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server