feat: surface quotedFileContent (anchor text) in comment reading
When reading comments via read_document_comments / read_spreadsheet_comments / read_presentation_comments, the Drive API's quotedFileContent.value field is now requested and displayed as "Quoted text:" in the output. This shows which specific text in the document each comment is anchored to. Comments without anchor text (document-level comments) omit the line. Relates to #210 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -195,7 +195,7 @@ async def _read_comments_impl(service, app_name: str, file_id: str) -> str:
|
||||
service.comments()
|
||||
.list(
|
||||
fileId=file_id,
|
||||
fields="comments(id,content,author,createdTime,modifiedTime,resolved,replies(content,author,id,createdTime,modifiedTime))",
|
||||
fields="comments(id,content,author,createdTime,modifiedTime,resolved,quotedFileContent,replies(content,author,id,createdTime,modifiedTime))",
|
||||
)
|
||||
.execute
|
||||
)
|
||||
@@ -215,9 +215,13 @@ async def _read_comments_impl(service, app_name: str, file_id: str) -> str:
|
||||
comment_id = comment.get("id", "")
|
||||
status = " [RESOLVED]" if resolved else ""
|
||||
|
||||
quoted_text = comment.get("quotedFileContent", {}).get("value", "")
|
||||
|
||||
output.append(f"Comment ID: {comment_id}")
|
||||
output.append(f"Author: {author}")
|
||||
output.append(f"Created: {created}{status}")
|
||||
if quoted_text:
|
||||
output.append(f"Quoted text: {quoted_text}")
|
||||
output.append(f"Content: {content}")
|
||||
|
||||
# Add replies if any
|
||||
|
||||
Reference in New Issue
Block a user