Skip to main content
Glama
PSPDFKit

Nutrient DWS MCP Server

by PSPDFKit

document_processor

Process document files with annotations, OCR, page rotation, watermarking, and redaction. Export outputs in PDF, images, JSON, or Office formats using the Nutrient DWS MCP Server.

Instructions

Processes documents using Nutrient DWS Processor API. Reads from and writes to file system or sandbox (if enabled).

Features: • Import XFDF annotations • Flatten annotations • OCR processing • Page rotation • Watermarking (text/image) • Redaction creation and application

Output formats: PDF, PDF/A, images (PNG, JPEG, WebP), JSON extraction, Office (DOCX, XLSX, PPTX)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instructionsYesBuild instructions.
outputPathYesA path to the output file to. (if required) Resolves to sandbox path if enabled, otherwise resolves to the local file system.

Implementation Reference

  • Implements the core handler logic for the 'document_processor' tool by processing build instructions, handling file references and URLs, calling the Nutrient DWS build API, and managing file or JSON responses.
    export async function performBuildCall(instructions: Instructions, outputFilePath: string): Promise<CallToolResult> { const { instructions: adjustedInstructions, fileReferences } = await processInstructions(instructions) if (fileReferences.size === 0) { return createErrorResponse('Error: No valid files or urls found in instructions') } try { // We resolve the output path first to fail early const resolvedOutputPath = await resolveWriteFilePath(outputFilePath) const response = await makeApiBuildCall(adjustedInstructions, fileReferences) if (adjustedInstructions.output?.type === 'json-content') { return handleJsonContentResponse(response) } else { return handleFileResponse(response, resolvedOutputPath, 'File processed successfully using build API') } } catch (e: unknown) { return handleApiError(e) } }
  • Defines the Zod schema BuildAPIArgsSchema used for input validation of the 'document_processor' tool, including instructions and outputPath.
    export const BuildAPIArgsSchema = z.object({ instructions: InstructionsSchema.describe('Build instructions.'), outputPath: z .string() .describe( 'A path to the output file to. (if required) Resolves to sandbox path if enabled, otherwise resolves to the local file system.', ), })
  • src/index.ts:35-55 (registration)
    Registers the 'document_processor' MCP tool with the McpServer, specifying its description, input schema from BuildAPIArgsSchema.shape, and handler delegating to performBuildCall.
    'document_processor', `Processes documents using Nutrient DWS Processor API. Reads from and writes to file system or sandbox (if enabled). Features: • Import XFDF annotations • Flatten annotations • OCR processing • Page rotation • Watermarking (text/image) • Redaction creation and application Output formats: PDF, PDF/A, images (PNG, JPEG, WebP), JSON extraction, Office (DOCX, XLSX, PPTX)`, BuildAPIArgsSchema.shape, async ({ instructions, outputPath }) => { try { return performBuildCall(instructions, outputPath) } catch (error) { return createErrorResponse(`Error: ${error instanceof Error ? error.message : String(error)}`) } }, )

Other Tools

Related 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/PSPDFKit/nutrient-dws-mcp-server'

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