A Microsoft Word API mock for organizing documents.
Your agent works with seeded documents through Microsoft Graph. Create a folder under Contracts, then list its children to check the folder’s name and location.
folder_createdCalls POST /v1.0/me/drive/items/*/children
Starting records
items
- path
/Contracts
users
ancha@acme.example- displayName
Ancha Assistant
Connect your agent to the Microsoft Word mock
When ancha runs your agent, it sets:
MICROSOFT_GRAPH_API_URLMICROSOFT_GRAPH_ACCESS_TOKEN
Point the client you already use at them.
import { Client } from '@microsoft/microsoft-graph-client';
const token = process.env.MICROSOFT_GRAPH_ACCESS_TOKEN!;
const graph = Client.init({ baseUrl: process.env.MICROSOFT_GRAPH_API_URL + '/', defaultVersion: 'v1.0', authProvider: (done) => done(null, token), fetchOptions: { headers: { authorization: 'Bearer ' + token } } });
const files = await graph.api('/me/drive/root/children').get();
// Next page: graph.api(files['@odata.nextLink'].slice(files['@odata.nextLink'].indexOf('/v1.0') + 5)).get()Locally, ancha runs your agent as an ordinary process, so keep real Microsoft Word credentials out of its environment.
See all 21 endpoints
download
/download/{token}monitor
/monitor/{token}v1
/v1.0/me/v1.0/me/drive/v1.0/me/drive/items/{item-id}/v1.0/me/drive/items/{item-id}/v1.0/me/drive/items/{item-id}/v1.0/me/drive/items/{item-id}/children/v1.0/me/drive/items/{item-id}/children/v1.0/me/drive/items/{item-id}/content/v1.0/me/drive/items/{item-id}/copy/v1.0/me/drive/items/{item-id}/createLink/v1.0/me/drive/items/{item-id}/invite/v1.0/me/drive/items/{item-id}/permissions/v1.0/me/drive/items/{item-id}/permissions/{perm-id}/v1.0/me/drive/items/{item-id}/versions/v1.0/me/drive/items/{item-id}/versions/{version-id}/content/v1.0/me/drive/items/{item-id}/versions/{version-id}/restoreVersion/v1.0/me/drive/items/{parent-id}:/{filename}:/content/v1.0/me/drive/recent/v1.0/me/drive/root/search(q='{text}')Seed your own data
The data the Microsoft Word mock starts with on every run, cut to a few records. ancha twins seed microsoft-word prints every field.
Full seed YAML
twins:
- microsoft-word
seed:
microsoft-word:
tenant:
name: Acme
domain: acme.example
me: ancha@acme.example
users:
- email: ancha@acme.example
displayName: Ancha Assistant
jobTitle: Automation service account
items:
- path: /Contracts
kind: folder
created: -5000h
Check what your agent did
Checks YAML
checks:
- id: folder_created
trace:
called: POST /v1.0/me/drive/items/*/childrenMore docs and files tools
All 43 toolsMicrosoft Word API mock FAQ
Can my document agent find a Word file by words inside it?
Ancha’s Microsoft Word mock searches file names and text extracted from .docx files through /. Every search word must appear, and matching ignores letter case.
How do I catch an agent overwriting a newer document version?
Send the document’s eTag in If-Match when replacing its content in the mock. A stale tag returns 412 with resourceModified before the file changes.
Does uploading revised Word content create a version I can inspect?
Replacing a file through PUT / stores the new bytes and adds a version in the mock. GET / lists versions newest first, with id, lastModifiedDateTime, size and lastModifiedBy.
Install the CLI and run your agent against the Microsoft Word mock.
Ancha is not affiliated with Microsoft Word.