Skip to main content
Glama

review.test-mapfile

Test mapfile macros with security validation to identify and prevent unauthorized tags in Re:VIEW manuscripts.

Instructions

Test #@mapfile macro with security validation (developer tool)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdYes
fileYes

Implementation Reference

  • Primary MCP tool handler for 'review.test-mapfile'. Validates mapfile path and size using security config, then calls the core testMapfileCommand.
    case "review.test-mapfile": { const securityConfig = await loadSecurityConfig(args.cwd as string); const pathValidation = validateMapfilePath(args.file as string, securityConfig); if (!pathValidation.valid) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: `Security validation failed: ${pathValidation.reason}` }) } ] }; } const sizeValidation = await validateMapfileSize( args.file as string, args.cwd as string, securityConfig ); if (!sizeValidation.valid) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: `File size validation failed: ${sizeValidation.reason}` }) } ] }; } const result = await hybridCommands.testMapfile({ file: args.file as string, cwd: args.cwd as string }); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; }
  • Core logic for testing #@mapfile macro: writes a test .re file embedding the mapfile, preprocesses it with Re:VIEW, reads the output, and reports success with processed content.
    export async function testMapfileCommand(options: TestMapfileOptions) { const { file, cwd } = options; const testFile = path.join(cwd, "test-mapfile.re"); const testContent = `//list[test]{ #@mapfile(${file}) #@end //} `; try { await fs.writeFile(testFile, testContent, "utf-8"); const result = await preprocessCommand({ pattern: "test-mapfile.re", output: ".out", stats: true, cwd }); await fs.unlink(testFile).catch(() => {}); if (result.success) { const outputFile = path.join(cwd, ".out", "test-mapfile.re"); const processedContent = await fs.readFile(outputFile, "utf-8").catch(() => ""); return { success: true, processedContent, stats: result.stats }; } return result; } catch (error: any) { await fs.unlink(testFile).catch(() => {}); return { success: false, error: error.message }; } }
  • MCP tool schema: defines name, description, and input schema (cwd and file) advertised via ListTools.
    { name: "review.test-mapfile", description: "Test #@mapfile macro with security validation (developer tool)", inputSchema: { type: "object", properties: { cwd: { type: "string" }, file: { type: "string" } }, required: ["cwd", "file"] } },
  • TypeScript interface for testMapfileCommand input options, matching the tool's inputSchema.
    export interface TestMapfileOptions { file: string; cwd: string; }
  • Exports hybridCommands object registering testMapfileCommand for import and use in src/index.ts.
    export const hybridCommands = { preprocess: preprocessCommand, buildPdfHybrid: buildPdfHybridCommand, checkRubyExtensions: checkRubyExtensionsCommand, testMapfile: testMapfileCommand };

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/dsgarage/ReviewMCP'

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