Skip to main content
Glama
Swih

Mistral MCP — Document Extraction

by Swih

Mistral OCR (document to markdown)

mistral_ocr
Read-onlyIdempotent

OCR PDFs and images into structured Markdown per page, capturing tables, headers, footers, blocks, and optional JSON annotations.

Instructions

Run Mistral OCR on a PDF or image, returning structured markdown per page.

Input document is one of:

  • { type: "document_url", documentUrl: "https://...pdf" }

  • { type: "image_url", imageUrl: "https://..." | "data:image/..." }

  • { type: "file", fileId: "" }

Options:

  • pages: array of 0-indexed page numbers or string like "0-5,7".

  • tableFormat: 'markdown' (default) or 'html'.

  • extractHeader / extractFooter: include page header/footer when present.

  • includeImageBase64: embed extracted image bytes as base64 in the response.

  • document_annotation_format: JSON schema for whole-document structured extraction.

  • bbox_annotation_format: JSON schema for extracted image / bbox annotations.

  • confidence_scores_granularity: 'page', 'word', or 'block'. 'block' adds per-block content/type confidence under pages[].blocks[].confidence_scores and requires OCR 4.1 or newer.

  • includeBlocks: return paragraph-level blocks (bounding box + type) in reading order — titles, lists, tables, images, equations, captions, code, references, aside text, header, footer, signature. Requires OCR 4 (mistral-ocr-4-0) or newer; older models accept the flag but return an empty blocks array.

Returns pages[].markdown plus optional pages[].hyperlinks, header, footer, images bounding boxes, blocks, annotations, confidence scores, and dimensions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNoOCR model. Default: mistral-ocr-latest.
pagesNoZero-based page numbers to process, as an array or comma-separated numbers and ranges such as "0-5,7".
documentYesDocument to process, supplied as a document URL, an image URL or data URI, or an uploaded file ID.
imageLimitNoMaximum number of images to extract from the document.
tableFormatNoFormat for extracted tables: Markdown or HTML.
imageMinSizeNoMinimum height and width of an image to extract.
extractFooterNoExtract each page footer into its footer field and remove it from the page markdown.
extractHeaderNoExtract each page header into its header field and remove it from the page markdown.
includeBlocksNoReturn paragraph-level blocks (bounding box + type) per page. Requires OCR 4 (mistral-ocr-4-0) or newer.
includeImageBase64NoInclude base64-encoded data for extracted images in the response.
bbox_annotation_formatNoJSON Schema for structured annotations of each extracted bounding box or image.
document_annotation_formatNoJSON Schema for a structured annotation extracted from the entire document.
document_annotation_promptNoInstructions for whole-document structured extraction. Requires document_annotation_format.
confidence_scores_granularityNoConfidence granularity. 'block' also fills pages[].blocks[].confidence_scores and requires OCR 4.1 (mistral-ocr-4-1) or newer.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYes
pagesYes
usageNo
annotationsNo
pages_countYes
document_annotationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed49 schema fields changedv0.8.3
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / bbox_annotation_format / additionalProperties
      Removed value: -false
    • addedInput schema / properties / bbox_annotation_format / description
      Added value: +"JSON Schema for structured annotations of each extracted bounding box or image."
    • removedInput schema / properties / bbox_annotation_format / properties / json_schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / bbox_annotation_format / properties / json_schema / description
      Added value: +"Named JSON Schema and optional strictness for the extracted annotation."
    • addedInput schema / properties / bbox_annotation_format / properties / json_schema / properties / description / description
      Added value: +"Description of the annotation to extract."
    • addedInput schema / properties / bbox_annotation_format / properties / json_schema / properties / name / description
      Added value: +"Name identifying the annotation schema."
    • addedInput schema / properties / bbox_annotation_format / properties / json_schema / properties / schema / description
      Added value: +"JSON Schema object defining the fields to extract into the annotation."
    • addedInput schema / properties / bbox_annotation_format / properties / json_schema / properties / schema / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / bbox_annotation_format / properties / json_schema / properties / strict / description
      Added value: +"Whether the annotation must strictly follow the supplied JSON Schema."
    • addedInput schema / properties / confidence_scores_granularity / description
      Added value: +"Confidence granularity. 'block' also fills pages[].blocks[].confidence_scores and requires OCR 4.1 (mistral-ocr-4-1) or newer."
    • changedInput schema / properties / confidence_scores_granularity / enum
      Previous value: -[
      -  "page",
      -  "word"
      -]New value: +[
      +  "page",
      +  "word",
      +  "block"
      +]
    • changedInput schema / properties / document / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "documentName": {
      -        "type": "string"
      -      },
      -      "documentUrl": {
      -        "description": "HTTPS URL to a PDF or image.",
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "document_url",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "documentUrl"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "imageUrl": {
      -        "description": "HTTPS URL or data:image/...;base64,... payload.",
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "image_url",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "imageUrl"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "fileId": {
      -        "description": "ID of a file previously uploaded via the Files API.",
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "file",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "fileId"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "properties": {
      +      "documentName": {
      +        "description": "Filename of the referenced document.",
      +        "type": "string"
      +      },
      +      "documentUrl": {
      +        "description": "HTTPS URL to a PDF or image.",
      +        "type": "string"
      +      },
      +      "type": {
      +        "const": "document_url",
      +        "description": "Read the document from documentUrl.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "documentUrl"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "imageUrl": {
      +        "description": "HTTPS URL or data:image/...;base64,... payload.",
      +        "type": "string"
      +      },
      +      "type": {
      +        "const": "image_url",
      +        "description": "Read the image from the URL or data URI in imageUrl.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "imageUrl"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "fileId": {
      +        "description": "ID of a file previously uploaded via the Files API.",
      +        "type": "string"
      +      },
      +      "type": {
      +        "const": "file",
      +        "description": "Read a previously uploaded file identified by fileId.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "fileId"
      +    ],
      +    "type": "object"
      +  }
      +]
    • addedInput schema / properties / document / description
      Added value: +"Document to process, supplied as a document URL, an image URL or data URI, or an uploaded file ID."
    • removedInput schema / properties / document_annotation_format / $ref
      Removed value: -"#/properties/bbox_annotation_format"
    • addedInput schema / properties / document_annotation_format / description
      Added value: +"JSON Schema for a structured annotation extracted from the entire document."
    • addedInput schema / properties / document_annotation_format / properties
      Added value: +{
      +  "json_schema": {
      +    "description": "Named JSON Schema and optional strictness for the extracted annotation.",
      +    "properties": {
      +      "description": {
      +        "description": "Description of the annotation to extract.",
      +        "type": "string"
      +      },
      +      "name": {
      +        "description": "Name identifying the annotation schema.",
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "schema": {
      +        "additionalProperties": {},
      +        "description": "JSON Schema object defining the fields to extract into the annotation.",
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "strict": {
      +        "description": "Whether the annotation must strictly follow the supplied JSON Schema.",
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "schema"
      +    ],
      +    "type": "object"
      +  },
      +  "type": {
      +    "const": "json_schema",
      +    "description": "Only json_schema is accepted by OCR annotation formats.",
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / document_annotation_format / required
      Added value: +[
      +  "type",
      +  "json_schema"
      +]
    • addedInput schema / properties / document_annotation_format / type
      Added value: +"object"
    • addedInput schema / properties / document_annotation_prompt / description
      Added value: +"Instructions for whole-document structured extraction. Requires document_annotation_format."
    • addedInput schema / properties / extractFooter / description
      Added value: +"Extract each page footer into its footer field and remove it from the page markdown."
    • addedInput schema / properties / extractHeader / description
      Added value: +"Extract each page header into its header field and remove it from the page markdown."
    • addedInput schema / properties / imageLimit / description
      Added value: +"Maximum number of images to extract from the document."
    • addedInput schema / properties / imageLimit / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / imageMinSize / description
      Added value: +"Minimum height and width of an image to extract."
    • addedInput schema / properties / imageMinSize / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / includeBlocks
      Added value: +{
      +  "description": "Return paragraph-level blocks (bounding box + type) per page. Requires OCR 4 (mistral-ocr-4-0) or newer.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / includeImageBase64 / description
      Added value: +"Include base64-encoded data for extracted images in the response."
    • removedInput schema / properties / model / enum
      Removed value: -[
      -  "mistral-ocr-latest"
      -]
    • addedInput schema / properties / model / maxLength
      Added value: +200
    • addedInput schema / properties / model / minLength
      Added value: +1
    • changedInput schema / properties / pages / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "minimum": 0,
      -      "type": "integer"
      -    },
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "maximum": 9007199254740991,
      +      "minimum": 0,
      +      "type": "integer"
      +    },
      +    "type": "array"
      +  }
      +]
    • addedInput schema / properties / pages / description
      Added value: +"Zero-based page numbers to process, as an array or comma-separated numbers and ranges such as \"0-5,7\"."
    • addedInput schema / properties / tableFormat / description
      Added value: +"Format for extracted tables: Markdown or HTML."
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / properties / annotations / properties / image_annotations / items / properties / page_index / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / annotations / properties / image_annotations / items / properties / page_index / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / pages / items / properties / blocks
      Added value: +{
      +  "description": "Paragraph-level blocks in reading order. Populated when `includeBlocks: true` and the model is OCR 4 or newer.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "bottom_right_x": {
      +        "type": "number"
      +      },
      +      "bottom_right_y": {
      +        "type": "number"
      +      },
      +      "confidence_scores": {
      +        "additionalProperties": false,
      +        "description": "Populated only when `confidence_scores_granularity: 'block'`. Fields are null when the signal is absent (an image-only block has no content to score).",
      +        "properties": {
      +          "average_content_confidence_score": {
      +            "anyOf": [
      +              {
      +                "type": "number"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          },
      +          "block_type_confidence_score": {
      +            "anyOf": [
      +              {
      +                "type": "number"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          },
      +          "minimum_content_confidence_score": {
      +            "anyOf": [
      +              {
      +                "type": "number"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "content": {
      +        "type": "string"
      +      },
      +      "image_id": {
      +        "description": "Set on type:image — references the matching entry in `images[]`.",
      +        "type": "string"
      +      },
      +      "table_id": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "description": "Set on type:table — references the matching entry in `tables[]`."
      +      },
      +      "top_left_x": {
      +        "type": "number"
      +      },
      +      "top_left_y": {
      +        "type": "number"
      +      },
      +      "type": {
      +        "enum": [
      +          "text",
      +          "title",
      +          "list",
      +          "table",
      +          "image",
      +          "equation",
      +          "caption",
      +          "code",
      +          "references",
      +          "aside_text",
      +          "header",
      +          "footer",
      +          "signature"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "top_left_x",
      +      "top_left_y",
      +      "bottom_right_x",
      +      "bottom_right_y",
      +      "content"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / pages / items / properties / confidence_scores / properties / word_confidence_scores / items / properties / start_index / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / pages / items / properties / confidence_scores / properties / word_confidence_scores / items / properties / start_index / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / pages / items / properties / footer / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / pages / items / properties / footer / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
    • addedOutput schema / properties / pages / items / properties / header / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / pages / items / properties / header / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
    • addedOutput schema / properties / pages / items / properties / index / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / pages / items / properties / index / minimum
      Added value: +-9007199254740991
    • addedOutput schema / properties / pages_count / maximum
      Added value: +9007199254740991
    • addedOutput schema / properties / pages_count / minimum
      Added value: +-9007199254740991
  2. Changed7 schema fields changedv0.7.0
    • addedInput schema / properties / bbox_annotation_format
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "json_schema": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "description": {
      +          "type": "string"
      +        },
      +        "name": {
      +          "minLength": 1,
      +          "type": "string"
      +        },
      +        "schema": {
      +          "additionalProperties": {},
      +          "type": "object"
      +        },
      +        "strict": {
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "name",
      +        "schema"
      +      ],
      +      "type": "object"
      +    },
      +    "type": {
      +      "const": "json_schema",
      +      "description": "Only json_schema is accepted by OCR annotation formats.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "type",
      +    "json_schema"
      +  ],
      +  "type": "object"
      +}
    • addedInput schema / properties / confidence_scores_granularity
      Added value: +{
      +  "enum": [
      +    "page",
      +    "word"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / document_annotation_format
      Added value: +{
      +  "$ref": "#/properties/bbox_annotation_format"
      +}
    • addedInput schema / properties / document_annotation_prompt
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / annotations
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "document_annotation": {
      +      "type": "string"
      +    },
      +    "image_annotations": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "annotation": {
      +            "type": "string"
      +          },
      +          "bbox": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "bottom_right_x": {
      +                "type": "number"
      +              },
      +              "bottom_right_y": {
      +                "type": "number"
      +              },
      +              "top_left_x": {
      +                "type": "number"
      +              },
      +              "top_left_y": {
      +                "type": "number"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "image_id": {
      +            "type": "string"
      +          },
      +          "page_index": {
      +            "type": "integer"
      +          }
      +        },
      +        "required": [
      +          "page_index",
      +          "annotation"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / properties / pages / items / properties / confidence_scores
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "average_page_confidence_score": {
      +      "type": "number"
      +    },
      +    "minimum_page_confidence_score": {
      +      "type": "number"
      +    },
      +    "word_confidence_scores": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "confidence": {
      +            "type": "number"
      +          },
      +          "start_index": {
      +            "type": "integer"
      +          },
      +          "text": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "text",
      +          "confidence",
      +          "start_index"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "average_page_confidence_score",
      +    "minimum_page_confidence_score"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / pages / items / properties / images / items / properties / image_annotation
      Added value: +{
      +  "type": "string"
      +}
  3. First observedv0.4.0

TDQS

A4.2/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (which only declare read-only, idempotent, non-destructive, open-world), the description discloses real behavioral preconditions: includeBlocks requires OCR 4+, confidence_scores_granularity='block' requires OCR 4.1+, and older models silently accept includeBlocks but return an empty blocks array. That silent-failure warning is exactly the kind of context an agent cannot get from the schema or annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with a one-line purpose, then cleanly sectioned into input shapes, options, and returns for a 14-parameter tool. The length is proportionate to the surface area and each bullet maps to a decision the caller must make.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only OCR tool with a full output schema and 100% schema coverage, the description supplies everything else needed: the three mutually exclusive document input forms, option semantics, model-version gates, and the shape of the response. Nothing an agent needs to invoke it correctly is absent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds genuine value on several parameters the schema documents only tersely: the annotated string form of `pages` ('0-5,7'), the default of tableFormat, the distinction between document_annotation_format and bbox_annotation_format, and the version requirements tied to includeBlocks and confidence granularity. Some parameters (imageLimit, imageMinSize, model) are untouched, which keeps it from a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource ('Run Mistral OCR on a PDF or image') and states the core output ('returning structured markdown per page'). It is clear, but it never distinguishes itself from siblings like mistral_vision or process_document, so an agent cannot tell from the description alone which of those overlapping tools to pick.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the enumerated input shapes and option list, but there is no explicit when-to-use or when-not-to-use guidance, and no routing to alternative siblings such as mistral_vision for image-only OCR. The reader must infer the fit from the parameter list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.