Skip to main content
Glama

review.build-pdf-hybrid

Generate PDF documents from Re:VIEW manuscripts using a JS-to-Ruby hybrid pipeline that prioritizes PDF output quality and format compliance.

Instructions

JS→Ruby hybrid pipeline for PDF generation (PDF first priority)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdYes
configNo
skipPreprocessNo

Implementation Reference

  • Core implementation of the tool: optionally preprocesses Re:VIEW files and runs `review-pdfmaker` to generate PDF artifacts.
    export async function buildPdfHybridCommand(options: BuildPdfOptions) {
      const {
        config = "config.yml",
        skipPreprocess = false,
        cwd
      } = options;
    
      const results: any[] = [];
    
      if (!skipPreprocess) {
        console.log("[build-pdf-hybrid] Running preprocessor...");
        const preprocessResult = await preprocessCommand({ cwd });
        results.push({ step: "preprocess", result: preprocessResult });
        
        if (!preprocessResult.success) {
          return {
            success: false,
            error: "Preprocessing failed",
            results
          };
        }
      }
    
      console.log("[build-pdf-hybrid] Building PDF with review-pdfmaker...");
      try {
        const pdfResult = await runCommand("review-pdfmaker", ["-c", config], { 
          cwd,
          useBundle: true 
        });
        
        results.push({ step: "pdf-build", result: { 
          success: true, 
          output: pdfResult.stdout 
        }});
    
        const pdfFiles = await findGeneratedPdf(cwd);
        
        return {
          success: true,
          results,
          artifacts: pdfFiles
        };
      } catch (error: any) {
        results.push({ step: "pdf-build", result: { 
          success: false, 
          error: error.message,
          stderr: error.stderr 
        }});
        
        return {
          success: false,
          error: "PDF build failed",
          results
        };
      }
    }
  • Tool schema definition: name, description, and input schema for parameters cwd (required), config, skipPreprocess.
    {
      name: "review.build-pdf-hybrid",
      description: "JS→Ruby hybrid pipeline for PDF generation (PDF first priority)",
      inputSchema: {
        type: "object",
        properties: {
          cwd: { type: "string" },
          config: { type: "string" },
          skipPreprocess: { type: "boolean" }
        },
        required: ["cwd"]
      }
    },
  • Handler case in the main CallToolRequestHandler switch that delegates to hybridCommands.buildPdfHybrid and returns the result.
    case "review.build-pdf-hybrid": {
      const result = await hybridCommands.buildPdfHybrid({
        cwd: args.cwd as string,
        config: args.config as string | undefined,
        skipPreprocess: args.skipPreprocess as boolean | undefined
      });
      return {
        content: [
          { type: "text", text: JSON.stringify(result) }
        ]
      };
    }
  • Registration of hybridCommands object exporting the buildPdfHybrid function for use in index.ts.
    export const hybridCommands = {
      preprocess: preprocessCommand,
      buildPdfHybrid: buildPdfHybridCommand,
      checkRubyExtensions: checkRubyExtensionsCommand,
      testMapfile: testMapfileCommand
  • TypeScript interface defining the input options for the buildPdfHybridCommand handler.
    export interface BuildPdfOptions {
      config?: string;
      skipPreprocess?: boolean;
      cwd: string;
    }

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