Skip to main content
Glama
PSPDFKit

Nutrient DWS MCP Server

by PSPDFKit

document_processor

Process documents to import annotations, flatten content, perform OCR, rotate pages, add watermarks, apply redactions, and convert to multiple formats including PDF, images, JSON, and Office files.

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

  • src/index.ts:35-55 (registration)
    Registration of the 'document_processor' MCP tool with description, input schema (BuildAPIArgsSchema), and wrapper handler calling 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)}`) } }, )
  • Core handler function 'performBuildCall' that processes document instructions, handles file/URL references, calls the Nutrient DWS build API, and returns the result or error.
    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) } }
  • Input schema 'BuildAPIArgsSchema' for the tool, including 'instructions' (complex nested schema for parts, actions, output) 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.', ), }) export type BuildAPIArgs = z.infer<typeof BuildAPIArgsSchema>

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