Skip to content

Commit 0f5b0c6

Browse files
authored
feat: add findMeetingTimes endpoint with Calendars.Read.Shared ORG-MODE scope (#143)
1 parent 3fc0222 commit 0f5b0c6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

bin/modules/simplified-openapi.mjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,35 @@ function findUsedSchemas(openApiSpec) {
396396
const schemasToProcess = [];
397397
const schemas = openApiSpec.components?.schemas || {};
398398
const responses = openApiSpec.components?.responses || {};
399+
const requestBodies = openApiSpec.components?.requestBodies || {};
399400
const paths = openApiSpec.paths || {};
400401

401402
Object.entries(paths).forEach(([, pathItem]) => {
402403
Object.entries(pathItem).forEach(([, operation]) => {
403404
if (typeof operation !== 'object') return;
404405

406+
if (operation.requestBody?.$ref) {
407+
const requestBodyName = operation.requestBody.$ref.replace(
408+
'#/components/requestBodies/',
409+
''
410+
);
411+
const requestBodyDefinition = requestBodies[requestBodyName];
412+
if (requestBodyDefinition?.content) {
413+
Object.values(requestBodyDefinition.content).forEach((content) => {
414+
if (content.schema?.$ref) {
415+
const schemaName = content.schema.$ref.replace('#/components/schemas/', '');
416+
schemasToProcess.push(schemaName);
417+
}
418+
if (content.schema?.properties) {
419+
findRefsInObject(content.schema.properties, (ref) => {
420+
const schemaName = ref.replace('#/components/schemas/', '');
421+
schemasToProcess.push(schemaName);
422+
});
423+
}
424+
});
425+
}
426+
}
427+
405428
if (operation.requestBody?.content) {
406429
Object.values(operation.requestBody.content).forEach((content) => {
407430
if (content.schema?.$ref) {

src/endpoints.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@
173173
"toolName": "list-calendars",
174174
"scopes": ["Calendars.Read"]
175175
},
176+
{
177+
"pathPattern": "/me/findMeetingTimes",
178+
"method": "post",
179+
"toolName": "find-meeting-times",
180+
"workScopes": ["Calendars.Read.Shared"]
181+
},
176182
{
177183
"pathPattern": "/me/drives",
178184
"method": "get",

0 commit comments

Comments
 (0)