Guide · Amazon Bedrock · Converse API · Multimodal

MCP Server Bedrock Converse Images and Documents — ImageBlock, DocumentBlock, multimodal inputs

Amazon Bedrock Converse API accepts images and documents alongside text in the same messages[i].content array — using ImageBlock and DocumentBlock structures. Both block types take either raw bytes as a Uint8Array in source.bytes or an S3 URI in source.s3Location. The single most common mistake is passing a base64-encoded string to source.bytes — the SDK field expects a Uint8Array of raw binary data, not a string, and passing a string causes a ValidationException. In Node.js, fs.readFileSync(path) returns a Buffer, which is a Uint8Array subclass and works directly; for base64 data received over HTTP use Buffer.from(b64str, 'base64'). The second most common mistake is omitting the name field from DocumentBlock — this field is required by the API and the model uses it in citations like "According to document 'report.pdf'". This guide covers both block structures in depth, the per-model support matrix (Claude 3+, Nova Pro/Lite, Titan, Llama Vision, Command R+), file size limits, S3 access configuration, and two complete MCP tool handler patterns for document analysis and vision tasks. For multi-turn usage of these blocks see Bedrock Converse overview; for returning image analysis results as tool results see Converse tool use; for streaming image analysis see Converse streaming.

TL;DR

Add { image: { format: 'jpeg', source: { bytes: uint8ArrayOfImageBytes } } } or { document: { format: 'pdf', name: 'report.pdf', source: { bytes: uint8ArrayOfPdfBytes } } } to messages[0].content alongside a text block. source.bytes is a Uint8Array — never a base64 string. The name field on DocumentBlock is required. Claude 3+ and Claude 4 support both; Nova Pro/Lite support images only; Titan and Command R+ support neither via Converse.

ImageBlock structure

An ImageBlock sits inside the content array of a Message object. The TypeScript type from @aws-sdk/client-bedrock-runtime is ContentBlock.ImageMember, but in practice you construct it as a plain object literal with an image key:

import {
  BedrockRuntimeClient,
  ConverseCommand,
  type Message,
} from "@aws-sdk/client-bedrock-runtime";
import * as fs from "node:fs";

const client = new BedrockRuntimeClient({ region: process.env.AWS_REGION ?? "us-east-1" });

// fs.readFileSync returns a Buffer, which IS a Uint8Array subclass — pass directly
const imageBytes: Uint8Array = fs.readFileSync("/tmp/screenshot.png");

const messages: Message[] = [
  {
    role: "user",
    content: [
      {
        image: {
          format: "png",          // 'jpeg' | 'png' | 'gif' | 'webp'
          source: {
            bytes: imageBytes,    // Uint8Array — NOT a base64 string
          },
        },
      },
      {
        text: "Describe what you see in this screenshot.",
      },
    ],
  },
];

const response = await client.send(
  new ConverseCommand({
    modelId: "anthropic.claude-3-5-sonnet-20241022-v2:0",
    messages,
  })
);

const reply = response.output?.message?.content
  ?.find((b) => "text" in b)?.text ?? "";

The format field is a required string literal: 'jpeg', 'png', 'gif', or 'webp'. The value must match the actual file format — passing 'png' for a JPEG will cause a ValidationException. For GIF inputs, only the first frame is analyzed; animated GIFs are treated as a single still image by all current Bedrock models.

To get bytes from a base64-encoded image string (common when receiving images over HTTP or from MCP tool arguments):

// Convert a base64 string to Uint8Array
function base64ToBytes(b64: string): Uint8Array {
  return Buffer.from(b64, "base64");
  // Buffer extends Uint8Array — no additional conversion needed
}

// Fetch an image URL and convert to bytes for Bedrock
async function fetchImageBytes(url: string): Promise<{ bytes: Uint8Array; format: string }> {
  const res = await fetch(url);
  if (!res.ok) throw new Error(`Failed to fetch image: ${res.status}`);

  const contentType = res.headers.get("content-type") ?? "";
  const formatMap: Record<string, string> = {
    "image/jpeg": "jpeg",
    "image/jpg":  "jpeg",
    "image/png":  "png",
    "image/gif":  "gif",
    "image/webp": "webp",
  };
  const format = formatMap[contentType.split(";")[0].trim()] ?? "jpeg";

  const arrayBuffer = await res.arrayBuffer();
  return { bytes: new Uint8Array(arrayBuffer), format };
}

DocumentBlock structure

DocumentBlock follows the same pattern as ImageBlock but requires an additional name field. The name is used by the model for citations in its response — it appears in phrases like "According to document 'contract.pdf', the clause states...". Omitting name causes a ValidationException: DocumentBlock name is required.

import * as fs from "node:fs";
import * as path from "node:path";

const filePath = "/tmp/quarterly-report.pdf";
const docBytes: Uint8Array = fs.readFileSync(filePath);

// name should be the filename without directory path
const docName = path.basename(filePath);  // "quarterly-report.pdf"

const messages: Message[] = [
  {
    role: "user",
    content: [
      {
        document: {
          format: "pdf",        // see supported formats below
          name: docName,        // required — omitting causes ValidationException
          source: {
            bytes: docBytes,    // Uint8Array — NOT a base64 string
          },
        },
      },
      {
        text: "Summarize the key financial metrics from this report.",
      },
    ],
  },
];

Supported format values for DocumentBlock: 'pdf', 'csv', 'doc', 'docx', 'xls', 'xlsx', 'html', 'txt', 'md'. The name field should be just the filename — not a full path. Including a path like "/tmp/report.pdf" in name is valid syntactically but produces awkward citation text; use path.basename() to strip the directory portion.

Determining the format from a file extension:

import * as path from "node:path";

type ImageFormat = "jpeg" | "png" | "gif" | "webp";
type DocumentFormat = "pdf" | "csv" | "doc" | "docx" | "xls" | "xlsx" | "html" | "txt" | "md";

function getImageFormat(filePath: string): ImageFormat | null {
  const ext = path.extname(filePath).toLowerCase().replace(".", "");
  const map: Record<string, ImageFormat> = {
    jpg:  "jpeg",
    jpeg: "jpeg",
    png:  "png",
    gif:  "gif",
    webp: "webp",
  };
  return map[ext] ?? null;
}

function getDocumentFormat(filePath: string): DocumentFormat | null {
  const ext = path.extname(filePath).toLowerCase().replace(".", "");
  const map: Record<string, DocumentFormat> = {
    pdf:  "pdf",
    csv:  "csv",
    doc:  "doc",
    docx: "docx",
    xls:  "xls",
    xlsx: "xlsx",
    html: "html",
    htm:  "html",
    txt:  "txt",
    md:   "md",
  };
  return map[ext] ?? null;
}

type BlockType = "image" | "document" | "unsupported";

function classifyFile(filePath: string): BlockType {
  if (getImageFormat(filePath) !== null) return "image";
  if (getDocumentFormat(filePath) !== null) return "document";
  return "unsupported";
}

Per-model support matrix

Not all Bedrock models support image and document inputs via Converse. Sending an unsupported block type produces a ValidationException with a message like "Document type not supported for this model" — not an image-related error message even when the issue is specifically about documents. The matrix as of late 2026:

Model family Example model ID ImageBlock DocumentBlock
Anthropic Claude 3 (Haiku, Sonnet, Opus) anthropic.claude-3-haiku-20240307-v1:0 Yes Yes
Anthropic Claude 3.5 (Sonnet, Haiku) anthropic.claude-3-5-sonnet-20241022-v2:0 Yes Yes
Anthropic Claude 4 (Sonnet, Opus) anthropic.claude-sonnet-4-5 Yes Yes
Amazon Nova Pro amazon.nova-pro-v1:0 Yes No — ValidationException
Amazon Nova Lite amazon.nova-lite-v1:0 Yes No — ValidationException
Amazon Nova Micro amazon.nova-micro-v1:0 No No
Amazon Titan (all variants) amazon.titan-text-express-v1 No No — use InvokeModel for Titan Multimodal Embeddings
Meta Llama 3.2 Vision (11B, 90B) meta.llama3-2-11b-instruct-v1:0 Yes No — ValidationException
Meta Llama 3.1, 3.3 (non-vision) meta.llama3-1-70b-instruct-v1:0 No No
Cohere Command R+ cohere.command-r-plus-v1:0 No No
Mistral (all variants) mistral.mistral-large-2402-v1:0 No No

When your MCP tool needs to support multiple models, check for image/document capability before constructing multimodal content. For image search with Amazon Titan, use the Titan Multimodal Embeddings API via InvokeModelCommand instead of Converse — Titan Multimodal Embeddings encodes images as dense vectors for similarity search, which is a different capability from visual question answering.

File size limits and context window considerations

Bedrock enforces hard size limits per block and per request. Exceeding them causes a ValidationException before the model is invoked:

Context window token consumption matters for multi-image requests. Claude 3.5 Sonnet has a 200k token context window, but each image in the request uses 1,000–4,000 tokens. Sending 20 images at the high end consumes up to 80,000 tokens just for the images — leaving 120,000 tokens for text and the model's response. For Claude 3 Haiku's 48k context window, 20 large images could exhaust the window entirely. Validate byte sizes before calling Converse:

const MAX_IMAGE_BYTES = 3.75 * 1024 * 1024;   // 3.75 MB
const MAX_DOCUMENT_BYTES = 4.5 * 1024 * 1024; // 4.5 MB

function validateImageSize(bytes: Uint8Array, label: string): void {
  if (bytes.byteLength > MAX_IMAGE_BYTES) {
    throw new Error(
      `Image "${label}" is ${(bytes.byteLength / 1024 / 1024).toFixed(2)} MB, ` +
      `exceeds the 3.75 MB per-image limit`
    );
  }
}

function validateDocumentSize(bytes: Uint8Array, label: string): void {
  if (bytes.byteLength > MAX_DOCUMENT_BYTES) {
    throw new Error(
      `Document "${label}" is ${(bytes.byteLength / 1024 / 1024).toFixed(2)} MB, ` +
      `exceeds the 4.5 MB per-document limit`
    );
  }
}

For large PDFs — above 100 pages — Bedrock will accept and process the document if it fits within the byte limit, but the extracted text may exhaust the model's context window. Claude processes PDFs via text layer extraction; a dense 150-page PDF can easily be 150,000+ tokens. Consider chunking large PDFs by page range before sending them to Converse.

S3 location format and access configuration

Instead of embedding raw bytes, both ImageBlock and DocumentBlock can reference objects in Amazon S3 via source.s3Location. This avoids the per-request size limits of base64 embedding and is better for large files stored durably in S3:

const messages: Message[] = [
  {
    role: "user",
    content: [
      {
        image: {
          format: "jpeg",
          source: {
            s3Location: {
              uri: "s3://my-bucket/images/product-photo.jpg",
              mediaType: "image/jpeg",   // must match actual file format
            },
          },
        },
      },
      {
        document: {
          format: "pdf",
          name: "contract.pdf",
          source: {
            s3Location: {
              uri: "s3://my-bucket/contracts/contract.pdf",
              mediaType: "application/pdf",
            },
          },
        },
      },
      {
        text: "Review the contract and check whether the product photo matches the described item.",
      },
    ],
  },
];

The uri field uses the s3://bucket/key format. The mediaType field is a standard MIME type string — it must match the actual content of the file. Common MIME types for Bedrock Converse: image/jpeg, image/png, image/gif, image/webp, application/pdf, text/csv, application/vnd.openxmlformats-officedocument.wordprocessingml.document (docx), text/plain, text/markdown.

S3 bucket policy for Bedrock access

The critical IAM detail: when Bedrock fetches objects from S3 for s3Location blocks, it uses the Bedrock service principal (bedrock.amazonaws.com) — not your Lambda execution role or ECS task role. Your application role only needs permission to call bedrock:InvokeModel; it is Bedrock itself that calls S3. This means you must grant s3:GetObject to the Bedrock service principal on your bucket, not to your application role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowBedrockS3Access",
      "Effect": "Allow",
      "Principal": {
        "Service": "bedrock.amazonaws.com"
      },
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::my-bucket/bedrock-inputs/*",
      "Condition": {
        "StringEquals": {
          "aws:SourceAccount": "123456789012"
        }
      }
    }
  ]
}

The aws:SourceAccount condition scopes the grant to Bedrock invocations originating from your account — preventing other accounts' Bedrock calls from reading your bucket. For cross-region setups, the S3 bucket must be in the same AWS region as the Bedrock endpoint you are calling. Using an S3 bucket in us-west-2 with a Bedrock endpoint in us-east-1 will produce an access error.

MCP pattern — document analysis tool

This MCP tool handler accepts a local file path, determines whether the file is an image or a document from its extension, constructs the appropriate Bedrock block, calls Converse with an analysis prompt, and returns the extracted content. It handles both block types in a single tool so callers do not need to know which block type to use:

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
import {
  BedrockRuntimeClient,
  ConverseCommand,
  type Message,
  type ContentBlock,
} from "@aws-sdk/client-bedrock-runtime";
import * as fs from "node:fs";
import * as path from "node:path";

const client = new BedrockRuntimeClient({ region: process.env.AWS_REGION ?? "us-east-1" });
const MODEL_ID = process.env.BEDROCK_MODEL_ID ?? "anthropic.claude-3-5-sonnet-20241022-v2:0";

const server = new McpServer({ name: "document-vision-server", version: "1.0.0" });

function buildFileBlock(filePath: string, bytes: Uint8Array): ContentBlock {
  const ext = path.extname(filePath).toLowerCase().replace(".", "");
  const name = path.basename(filePath);

  const imageExtMap: Record<string, "jpeg" | "png" | "gif" | "webp"> = {
    jpg: "jpeg", jpeg: "jpeg", png: "png", gif: "gif", webp: "webp",
  };
  const docExtMap: Record<string, "pdf" | "csv" | "doc" | "docx" | "xls" | "xlsx" | "html" | "txt" | "md"> = {
    pdf: "pdf", csv: "csv", doc: "doc", docx: "docx",
    xls: "xls", xlsx: "xlsx", html: "html", htm: "html", txt: "txt", md: "md",
  };

  if (imageExtMap[ext]) {
    return {
      image: {
        format: imageExtMap[ext],
        source: { bytes },
      },
    };
  }

  if (docExtMap[ext]) {
    return {
      document: {
        format: docExtMap[ext],
        name,                     // required — model uses this in citations
        source: { bytes },
      },
    };
  }

  throw new Error(`Unsupported file extension: .${ext}`);
}

server.tool(
  "analyze_file",
  {
    file_path: z.string().describe("Absolute path to the image or document file to analyze"),
    prompt: z.string().describe("Analysis instruction, e.g. 'Extract all table data as JSON' or 'Describe what you see'"),
  },
  async ({ file_path, prompt }) => {
    // Validate file exists
    if (!fs.existsSync(file_path)) {
      return { content: [{ type: "text", text: `File not found: ${file_path}` }] };
    }

    const bytes = fs.readFileSync(file_path);  // returns Buffer (Uint8Array subclass)

    // Validate size limits
    const MAX_IMAGE_BYTES = 3.75 * 1024 * 1024;
    const MAX_DOC_BYTES = 4.5 * 1024 * 1024;
    const ext = path.extname(file_path).toLowerCase().replace(".", "");
    const isImage = ["jpg", "jpeg", "png", "gif", "webp"].includes(ext);
    const limit = isImage ? MAX_IMAGE_BYTES : MAX_DOC_BYTES;
    if (bytes.byteLength > limit) {
      return {
        content: [{
          type: "text",
          text: `File is ${(bytes.byteLength / 1024 / 1024).toFixed(2)} MB, exceeds the ${isImage ? "3.75" : "4.5"} MB limit`,
        }],
      };
    }

    let fileBlock: ContentBlock;
    try {
      fileBlock = buildFileBlock(file_path, bytes);
    } catch (err) {
      return { content: [{ type: "text", text: (err as Error).message }] };
    }

    const messages: Message[] = [
      {
        role: "user",
        content: [fileBlock, { text: prompt }],
      },
    ];

    const response = await client.send(new ConverseCommand({ modelId: MODEL_ID, messages }));

    const text = response.output?.message?.content
      ?.find((b): b is { text: string } => "text" in b)
      ?.text ?? "(no response)";

    return { content: [{ type: "text", text }] };
  }
);

MCP pattern — vision tool for URLs and base64 input

This pattern accepts an image as either a URL or a base64-encoded string (both are common in MCP tool arguments), fetches or decodes it to a Uint8Array, and calls Converse with a task-specific vision prompt:

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
import {
  BedrockRuntimeClient,
  ConverseCommand,
  type Message,
} from "@aws-sdk/client-bedrock-runtime";

const client = new BedrockRuntimeClient({ region: process.env.AWS_REGION ?? "us-east-1" });
const MODEL_ID = "anthropic.claude-3-5-sonnet-20241022-v2:0";

const server = new McpServer({ name: "vision-server", version: "1.0.0" });

type SupportedFormat = "jpeg" | "png" | "gif" | "webp";

function formatFromMime(contentType: string): SupportedFormat {
  const stripped = contentType.split(";")[0].trim();
  const map: Record<string, SupportedFormat> = {
    "image/jpeg": "jpeg",
    "image/jpg":  "jpeg",
    "image/png":  "png",
    "image/gif":  "gif",
    "image/webp": "webp",
  };
  return map[stripped] ?? "jpeg";
}

async function imageInputToBytes(
  input: string
): Promise<{ bytes: Uint8Array; format: SupportedFormat }> {
  // Detect base64 data URI: data:image/png;base64,iVBORw0...
  const dataUriMatch = input.match(/^data:(image\/[^;]+);base64,(.+)$/);
  if (dataUriMatch) {
    const mime = dataUriMatch[1];
    const b64 = dataUriMatch[2];
    return {
      bytes: Buffer.from(b64, "base64"),  // Buffer is a Uint8Array subclass
      format: formatFromMime(mime),
    };
  }

  // Detect plain base64 string (no data URI prefix) — assume JPEG
  if (!input.startsWith("http://") && !input.startsWith("https://")) {
    return {
      bytes: Buffer.from(input, "base64"),
      format: "jpeg",
    };
  }

  // HTTP/HTTPS URL — fetch the image
  const res = await fetch(input, { signal: AbortSignal.timeout(10_000) });
  if (!res.ok) throw new Error(`Failed to fetch image from URL: ${res.status} ${res.statusText}`);

  const contentType = res.headers.get("content-type") ?? "image/jpeg";
  const arrayBuffer = await res.arrayBuffer();

  return {
    bytes: new Uint8Array(arrayBuffer),
    format: formatFromMime(contentType),
  };
}

server.tool(
  "extract_text_from_image",
  {
    image: z.string().describe(
      "Image as a URL (https://...), base64 string, or data URI (data:image/png;base64,...)"
    ),
    task: z.string().default("Extract all text from this image. Return the text verbatim, preserving line breaks."),
  },
  async ({ image, task }) => {
    let bytes: Uint8Array;
    let format: SupportedFormat;

    try {
      ({ bytes, format } = await imageInputToBytes(image));
    } catch (err) {
      return { content: [{ type: "text", text: `Failed to load image: ${(err as Error).message}` }] };
    }

    if (bytes.byteLength > 3.75 * 1024 * 1024) {
      return { content: [{ type: "text", text: "Image exceeds the 3.75 MB per-image limit" }] };
    }

    const messages: Message[] = [
      {
        role: "user",
        content: [
          { image: { format, source: { bytes } } },
          { text: task },
        ],
      },
    ];

    const response = await client.send(new ConverseCommand({ modelId: MODEL_ID, messages }));

    const text = response.output?.message?.content
      ?.find((b): b is { text: string } => "text" in b)
      ?.text ?? "(no response)";

    return { content: [{ type: "text", text }] };
  }
);

Multiple images and documents in one request

The content array can hold any mix of ImageBlock, DocumentBlock, and text blocks. Each block is processed by the model in order. This enables tasks like comparing two documents, checking a photo against a spec sheet, or analyzing multiple screenshots in a single turn:

import * as fs from "node:fs";
import * as path from "node:path";

// Two images + one document + one text question in a single Converse call
const screenshotA = fs.readFileSync("/tmp/before.png");
const screenshotB = fs.readFileSync("/tmp/after.png");
const specDoc = fs.readFileSync("/tmp/requirements.pdf");

const messages: Message[] = [
  {
    role: "user",
    content: [
      {
        document: {
          format: "pdf",
          name: path.basename("/tmp/requirements.pdf"),  // "requirements.pdf"
          source: { bytes: specDoc },
        },
      },
      {
        image: {
          format: "png",
          source: { bytes: screenshotA },
        },
      },
      {
        image: {
          format: "png",
          source: { bytes: screenshotB },
        },
      },
      {
        text: "The first image is the before state, the second is the after state. " +
              "Review both against the requirements document and list any requirements that are not satisfied.",
      },
    ],
  },
];

const response = await client.send(
  new ConverseCommand({
    modelId: "anthropic.claude-3-5-sonnet-20241022-v2:0",
    messages,
  })
);

When mixing block types: all blocks in a single user turn count toward the same context window budget. Claude 3.5 Sonnet has a 200k token context window, but each image consumes 1,000–4,000 tokens and a dense PDF can consume tens of thousands of tokens. For requests combining multiple images and large documents, estimate total token consumption before sending. A practical rule: if the combined byte size of all blocks exceeds 2 MB, verify that the total estimated token count fits comfortably within the model's context limit.

PDF extraction specifics and scanned PDFs

When a PDF is passed as a DocumentBlock, Claude extracts and reads the text layer. This works well for PDFs generated by software (Word exports, reports from BI tools, contracts from PDF editors). For scanned PDFs — where the pages are photographed images with no selectable text — the text layer is empty and Claude will not be able to read the content via DocumentBlock.

For scanned PDFs, the correct approach is to convert each page to a raster image and pass it as an ImageBlock. In Node.js, pdf2pic and pdfjs-dist both support this workflow:

// Using pdfjs-dist to render PDF pages to PNG buffers
import * as pdfjsLib from "pdfjs-dist/legacy/build/pdf.mjs";
import { createCanvas } from "canvas";

async function pdfPagesToImages(
  pdfBytes: Uint8Array,
  maxPages = 5
): Promise<Uint8Array[]> {
  const pdfDoc = await pdfjsLib.getDocument({ data: pdfBytes }).promise;
  const pageCount = Math.min(pdfDoc.numPages, maxPages);
  const pageImages: Uint8Array[] = [];

  for (let pageNum = 1; pageNum <= pageCount; pageNum++) {
    const page = await pdfDoc.getPage(pageNum);
    const viewport = page.getViewport({ scale: 2.0 }); // 2x scale for legibility

    const canvas = createCanvas(viewport.width, viewport.height);
    const ctx = canvas.getContext("2d");

    await page.render({
      canvasContext: ctx as unknown as CanvasRenderingContext2D,
      viewport,
    }).promise;

    // canvas.toBuffer returns a Buffer (Uint8Array subclass)
    pageImages.push(canvas.toBuffer("image/png"));
  }

  return pageImages;
}

// MCP tool: OCR a scanned PDF by rendering pages as images
server.tool(
  "ocr_scanned_pdf",
  {
    file_path: z.string().describe("Path to a scanned PDF file"),
    max_pages: z.number().int().min(1).max(10).default(5),
  },
  async ({ file_path, max_pages }) => {
    const pdfBytes = fs.readFileSync(file_path);
    let pageImages: Uint8Array[];

    try {
      pageImages = await pdfPagesToImages(pdfBytes, max_pages);
    } catch (err) {
      return { content: [{ type: "text", text: `PDF rendering failed: ${(err as Error).message}` }] };
    }

    // Build one ImageBlock per page
    const imageBlocks = pageImages.map((pageBytes) => ({
      image: {
        format: "png" as const,
        source: { bytes: pageBytes },
      },
    }));

    const messages: Message[] = [
      {
        role: "user",
        content: [
          ...imageBlocks,
          {
            text: `These are ${pageImages.length} pages from a scanned PDF. ` +
                  "Extract all visible text in document order. Preserve paragraph breaks and table structure.",
          },
        ],
      },
    ];

    const response = await client.send(
      new ConverseCommand({ modelId: MODEL_ID, messages })
    );

    const text = response.output?.message?.content
      ?.find((b): b is { text: string } => "text" in b)
      ?.text ?? "(no response)";

    return { content: [{ type: "text", text }] };
  }
);

When converting a large PDF to images for OCR, limit the number of pages per Converse call. Each page image at 2x scale is typically 300–800 KB and 2,000–4,000 tokens. Ten pages at the high end consumes 40,000 tokens just for images — still workable within Claude's 200k context, but monitor usage. For PDFs longer than 10 pages, process in batches of 5–10 pages and concatenate the extracted text from each batch.

Common gotchas and ValidationException causes

Most ValidationException errors with multimodal Converse inputs come from one of these five causes:

Additional edge cases to handle in production MCP tools:

IAM permissions for multimodal Converse

Using raw bytes in source.bytes requires only standard bedrock:InvokeModel permissions — your application role never touches S3. Using source.s3Location requires the bucket policy grant to bedrock.amazonaws.com as described above, but no additional IAM policy on your application role.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "BedrockConverseMultimodal",
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Resource": [
        "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0",
        "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-haiku-20240307-v1:0",
        "arn:aws:bedrock:us-east-1::foundation-model/amazon.nova-pro-v1:0",
        "arn:aws:bedrock:us-east-1::foundation-model/amazon.nova-lite-v1:0",
        "arn:aws:bedrock:us-east-1::foundation-model/meta.llama3-2-11b-instruct-v1:0"
      ]
    }
  ]
}

No additional IAM action is required specifically for multimodal content — it is part of the standard InvokeModel permission. The permission is enforced at the model ARN level; ensure the model IDs you use in modelId match ARNs listed in the policy. If you plan to use S3 references, also apply the bucket policy with the bedrock.amazonaws.com principal to your S3 bucket as shown in the S3 section above.

Monitor your multimodal MCP tools with AliveMCP

AliveMCP monitors MCP server endpoints for uptime, latency, and error rates. When a Bedrock Converse image or document tool handler starts returning ValidationExceptions — from oversized files, unsupported formats, or model capability mismatches — AliveMCP catches the spike and alerts you before it affects downstream agents relying on your vision tools.

Start free monitoring