OneNote: read handwriting, images and SharePoint notebooks
Problem
The OneNote adapter (intl/microsoft-onenote.json) reads a page through GET /me/onenote/pages/{id}/content, which returns HTML without ink. Many OneNote users write by hand with a pen (meeting notes, sketches, calculations), so the AI sees nothing of those pages. Embedded pictures and PDF printouts reach the AI only as <img> links to Graph that need the user's sign-in, so it cannot read them either.
Two smaller gaps in the same adapter:
- Notebooks stored on SharePoint team sites (
/sites/{id}/onenote,/groups/{id}/onenote) are not reachable; only/me/onenoteis. - There is no tool to fetch a single page resource (image or printout).
Proposed Solution
microsoft_onenote_get_resource(adapter JSON only):GET /me/onenote/resources/{id}/$valuewith the existing binary handling (connectors/binary-response.util.ts), so an image comes back as an MCP image content block that the model can read.- SharePoint and group notebooks (adapter JSON only): list notebooks, sections and pages under
/sites/{site-id}/onenoteand/groups/{group-id}/onenote. Check which delegated permission Graph needs for these (likelyNotes.Read.All/Notes.ReadWrite.All, admin consent) and document it in the adapter instructions. microsoft_onenote_get_page_image(engine change): render a page as PNG including ink.- Fetch
content?includeinkML=true(HTML plus InkML). - Parse the InkML traces (
fast-xml-parser, already a dependency) and draw each trace as an SVG path with its brush colour and width, scaled to page coordinates. - Fetch the page's images with the user's token and place them at their absolute positions.
- Rasterise with
@resvg/resvg-js(MPL-2.0, no browser needed); split tall pages into tiles of about 1,500 px on the long edge. - Return the typed text as text (as today) plus the image(s). Typed text is not drawn into the PNG; that would need a headless browser in the image.
- Opt-in per tool through a config key (e.g.
"render": "onenote-page"), following the opt-in pattern ofdecode/imagesinresponse-transform.util.ts, but run in the connector layer because it needs further authenticated Graph calls.
- Fetch
Alternatives Considered
- Handwriting recognition on our side: not needed; current models read handwriting from images well, and Graph exposes no recognised text for ink.
- Rendering the full page in headless Chromium: higher fidelity for typed text, but adds about 300 MB to the image and a lot of memory per render on the shared Cloud.
- Returning raw InkML: the model cannot use stroke coordinates meaningfully.
Area
Connectors / adapters (Microsoft OneNote), REST engine.
Additional Context
- Cloud and self-hosted behave the same; the new dependency ships in the backend image for both.
- Size limits: the 10 MB tool response cap and the per-tool
binary.maxBytesapply; tiles keep each image well below them. - InkML coordinate units need calibrating against real pages with pen input before release.
I'd like to work on the adapter-only parts of this issue, starting with resource downloads in a focused first PR using the existing binary-response handling, bounded content and encoded resource IDs.
One detail from the current Graph v1.0 resource documentation: the canonical endpoint is /me/onenote/resources/{id}/content, rather than /$value. I'll use that documented path. The current delegated permissions already cover this first slice, so it needs no auth-scope change or new dependency.
SharePoint/group notebook reads can follow separately with the permission requirements documented. The ink renderer remains a separate engine/dependency proposal and will not be bundled into the adapter PR.
The adapter pieces are in #1865 and #1866. For the ink renderer, I'll keep resource fetches on Graph with the same credentials, cap image bytes and canvas size, and test multipart parsing and stroke scaling separately.
Do you have a sanitized includeInkML=true response from a pen-written page, plus its expected preview? That would let me verify the coordinate alignment before calling the renderer ready.
The implementation is merged through #1865, #1866 and #1867. I have not had a real pen-written Graph response to verify coordinate calibration. Has that check been completed on your side, or should this stay open for it? I am moving on to #985 as agreed.
Thanks @Coding-Professional. No, that check is not done yet, and we don't have a sanitized pen-written response to share either. Let's keep this issue open until we can compare a real handwritten page with its preview. We will post here when we have one.