@piotr-agier/google-drive-mcp 2.0.0 → 2.0.1

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.
package/dist/index.js CHANGED
@@ -7660,23 +7660,19 @@ Slide ${a.slideIndex ?? index} (ID: ${slide.objectId}):
7660
7660
  if (!notesObjectId) {
7661
7661
  return errorResponse("This slide does not have a speaker notes object. Speaker notes may need to be initialized manually in Google Slides first.");
7662
7662
  }
7663
- const requests = [
7664
- {
7665
- deleteText: {
7666
- objectId: notesObjectId,
7667
- textRange: {
7668
- type: "ALL"
7669
- }
7670
- }
7671
- },
7672
- {
7673
- insertText: {
7674
- objectId: notesObjectId,
7675
- text: a.notes,
7676
- insertionIndex: 0
7677
- }
7678
- }
7679
- ];
7663
+ const notesPage = slide.slideProperties?.notesPage;
7664
+ const speakerNotesShape = notesPage?.pageElements?.find(
7665
+ (el) => el.objectId === notesObjectId
7666
+ );
7667
+ const existingTextElements = speakerNotesShape?.shape?.text?.textElements || [];
7668
+ const hasExistingText = existingTextElements.some(
7669
+ (el) => el.textRun?.content
7670
+ );
7671
+ const requests = [];
7672
+ if (hasExistingText) {
7673
+ requests.push({ deleteText: { objectId: notesObjectId, textRange: { type: "ALL" } } });
7674
+ }
7675
+ requests.push({ insertText: { objectId: notesObjectId, text: a.notes, insertionIndex: 0 } });
7680
7676
  await slidesService.presentations.batchUpdate({
7681
7677
  presentationId: a.presentationId,
7682
7678
  requestBody: { requests }