@softeria/ms-365-mcp-server 0.183.0 → 0.184.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -155,6 +155,9 @@ export function createAndSaveSimplifiedOpenAPI(
155
155
  return param;
156
156
  });
157
157
  }
158
+ if (eo.extraQueryParams) {
159
+ operation.parameters = applyExtraQueryParams(operation.parameters, eo);
160
+ }
158
161
  } else {
159
162
  delete value[method];
160
163
  }
@@ -183,6 +186,32 @@ export function createAndSaveSimplifiedOpenAPI(
183
186
  fs.writeFileSync(openapiTrimmedFile, yaml.dump(openApiSpec));
184
187
  }
185
188
 
189
+ // Adds the optional query params an endpoint declares in extraQueryParams (name -> JSON
190
+ // Schema), for options Microsoft's spec leaves out. A same-named spec param is replaced, not
191
+ // kept beside ours: the spec is downloaded fresh, so the build must survive Microsoft adding it.
192
+ export function applyExtraQueryParams(parameters, endpoint, warn = console.warn) {
193
+ const extras = Object.entries(endpoint.extraQueryParams ?? {});
194
+ if (extras.length === 0) return parameters;
195
+
196
+ const bare = (name) => String(name).replace(/^\$/, '').toLowerCase();
197
+ const declared = new Set(extras.map(([name]) => bare(name)));
198
+ const kept = (parameters ?? []).filter((param) => {
199
+ if (param.in !== 'query' || !declared.has(bare(param.name))) return true;
200
+ warn(
201
+ `${endpoint.toolName}: the spec now has query param ${param.name}; using extraQueryParams`
202
+ );
203
+ return false;
204
+ });
205
+ const added = extras.map(([name, { description, ...schema }]) => ({
206
+ name,
207
+ in: 'query',
208
+ required: false,
209
+ ...(description === undefined ? {} : { description }),
210
+ schema,
211
+ }));
212
+ return [...kept, ...added];
213
+ }
214
+
186
215
  // Microsoft's spec is generated from CSDL, so operations that are plain CRUD over a
187
216
  // navigation property never get prose. They get scaffolding naming the property and its
188
217
  // parent instead - "Create new navigation property to messages for users" - which
@@ -1259,7 +1259,13 @@
1259
1259
  "method": "get",
1260
1260
  "toolName": "get-onenote-page-content",
1261
1261
  "presets": ["onenote", "personal"],
1262
- "scopes": ["Notes.Read"]
1262
+ "scopes": ["Notes.Read"],
1263
+ "extraQueryParams": {
1264
+ "includeIDs": {
1265
+ "type": "boolean",
1266
+ "description": "Add each element's generated id, for use as an update target."
1267
+ }
1268
+ }
1263
1269
  },
1264
1270
  {
1265
1271
  "pathPattern": "/me/onenote/pages/{onenotePage-id}/content",
@@ -1276,7 +1282,7 @@
1276
1282
  "properties": {
1277
1283
  "target": {
1278
1284
  "type": "string",
1279
- "description": "Element to change: a data-id, the generated id, or a known name like 'body' or 'title'."
1285
+ "description": "Element to change: #<data-id>, a generated id (no #), or 'body' or 'title'. Most replace actions need the generated id: read the page content with includeIDs=true, and again after each update, as ids can change."
1280
1286
  },
1281
1287
  "action": {
1282
1288
  "type": "string",
@@ -1343,7 +1349,13 @@
1343
1349
  "method": "get",
1344
1350
  "toolName": "get-sharepoint-site-onenote-page-content",
1345
1351
  "presets": ["onenote", "work"],
1346
- "workScopes": ["Notes.Read.All"]
1352
+ "workScopes": ["Notes.Read.All"],
1353
+ "extraQueryParams": {
1354
+ "includeIDs": {
1355
+ "type": "boolean",
1356
+ "description": "Add each element's generated id, for use as an update target."
1357
+ }
1358
+ }
1347
1359
  },
1348
1360
  {
1349
1361
  "pathPattern": "/sites/{site-id}/onenote/notebooks",
@@ -1390,7 +1402,7 @@
1390
1402
  "properties": {
1391
1403
  "target": {
1392
1404
  "type": "string",
1393
- "description": "Element to change: a data-id, the generated id, or a known name like 'body' or 'title'."
1405
+ "description": "Element to change: #<data-id>, a generated id (no #), or 'body' or 'title'. Most replace actions need the generated id: read the page content with includeIDs=true, and again after each update, as ids can change."
1394
1406
  },
1395
1407
  "action": {
1396
1408
  "type": "string",
@@ -3723,7 +3723,7 @@ const microsoft_graph_onenotePageCollectionResponse = z.object({
3723
3723
  const update_onenote_page_content_Body = z.array(
3724
3724
  z.object({
3725
3725
  target: z.string().describe(
3726
- "Element to change: a data-id, the generated id, or a known name like 'body' or 'title'."
3726
+ "Element to change: #<data-id>, a generated id (no #), or 'body' or 'title'. Most replace actions need the generated id: read the page content with includeIDs=true, and again after each update, as ids can change."
3727
3727
  ),
3728
3728
  action: z.enum(["append", "insert", "prepend", "replace", "delete"]).describe("What to do at the target. 'delete' takes no content."),
3729
3729
  position: z.enum(["after", "before"]).describe(
@@ -11199,6 +11199,13 @@ resource.`,
11199
11199
  alias: "get-onenote-page-content",
11200
11200
  description: `The page's HTML content.`,
11201
11201
  requestFormat: "json",
11202
+ parameters: [
11203
+ {
11204
+ name: "includeIDs",
11205
+ type: "Query",
11206
+ schema: z.boolean().describe("Add each element's generated id, for use as an update target.").optional()
11207
+ }
11208
+ ],
11202
11209
  response: z.void()
11203
11210
  },
11204
11211
  {
@@ -14371,6 +14378,13 @@ The same item might appear more than once in a delta feed, for various reasons.
14371
14378
  alias: "get-sharepoint-site-onenote-page-content",
14372
14379
  description: `The page's HTML content.`,
14373
14380
  requestFormat: "json",
14381
+ parameters: [
14382
+ {
14383
+ name: "includeIDs",
14384
+ type: "Query",
14385
+ schema: z.boolean().describe("Add each element's generated id, for use as an update target.").optional()
14386
+ }
14387
+ ],
14374
14388
  response: z.void()
14375
14389
  },
14376
14390
  {
@@ -2318,7 +2318,8 @@ async function executeGraphTool(tool, config, graphClient, params, authManager,
2318
2318
  options.body = typeof body === "string" ? body : JSON.stringify(body);
2319
2319
  }
2320
2320
  }
2321
- const isProbablyMediaContent = tool.errors?.some((error) => error.description === "Retrieved media content") || path2.endsWith("/content");
2321
+ const isProbablyMediaContent = tool.errors?.some((error) => error.description === "Retrieved media content") || // path already carries the query string, e.g. ?includeIDs=true on OneNote page content
2322
+ path2.split("?")[0].endsWith("/content");
2322
2323
  if (config?.returnDownloadUrl && path2.endsWith("/content")) {
2323
2324
  path2 = path2.replace(/\/content$/, "");
2324
2325
  logger.info(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
3
  "mcpName": "io.github.Softeria/ms-365-mcp-server",
4
- "version": "0.183.0",
4
+ "version": "0.184.0",
5
5
  "description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -1259,7 +1259,13 @@
1259
1259
  "method": "get",
1260
1260
  "toolName": "get-onenote-page-content",
1261
1261
  "presets": ["onenote", "personal"],
1262
- "scopes": ["Notes.Read"]
1262
+ "scopes": ["Notes.Read"],
1263
+ "extraQueryParams": {
1264
+ "includeIDs": {
1265
+ "type": "boolean",
1266
+ "description": "Add each element's generated id, for use as an update target."
1267
+ }
1268
+ }
1263
1269
  },
1264
1270
  {
1265
1271
  "pathPattern": "/me/onenote/pages/{onenotePage-id}/content",
@@ -1276,7 +1282,7 @@
1276
1282
  "properties": {
1277
1283
  "target": {
1278
1284
  "type": "string",
1279
- "description": "Element to change: a data-id, the generated id, or a known name like 'body' or 'title'."
1285
+ "description": "Element to change: #<data-id>, a generated id (no #), or 'body' or 'title'. Most replace actions need the generated id: read the page content with includeIDs=true, and again after each update, as ids can change."
1280
1286
  },
1281
1287
  "action": {
1282
1288
  "type": "string",
@@ -1343,7 +1349,13 @@
1343
1349
  "method": "get",
1344
1350
  "toolName": "get-sharepoint-site-onenote-page-content",
1345
1351
  "presets": ["onenote", "work"],
1346
- "workScopes": ["Notes.Read.All"]
1352
+ "workScopes": ["Notes.Read.All"],
1353
+ "extraQueryParams": {
1354
+ "includeIDs": {
1355
+ "type": "boolean",
1356
+ "description": "Add each element's generated id, for use as an update target."
1357
+ }
1358
+ }
1347
1359
  },
1348
1360
  {
1349
1361
  "pathPattern": "/sites/{site-id}/onenote/notebooks",
@@ -1390,7 +1402,7 @@
1390
1402
  "properties": {
1391
1403
  "target": {
1392
1404
  "type": "string",
1393
- "description": "Element to change: a data-id, the generated id, or a known name like 'body' or 'title'."
1405
+ "description": "Element to change: #<data-id>, a generated id (no #), or 'body' or 'title'. Most replace actions need the generated id: read the page content with includeIDs=true, and again after each update, as ids can change."
1394
1406
  },
1395
1407
  "action": {
1396
1408
  "type": "string",