Conversation
🦋 Changeset detectedLatest commit: b1fa80b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
…istency Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
baruchiro
left a comment
There was a problem hiding this comment.
- Remove code comments.
- let's take the author's suggestion: #27 (comment). Omit the content by default, and implement another tool to retrieve the content.
- The future preparation with the options and fields properties is overkill.
- I think excluding the content and supplying it via another tool is a feature change (but I'm not sure it is a breaking change).
…ent_content tool Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
I've simplified the implementation per your suggestions:
The implementation is now much simpler with commits cde4cf3, a9d4a69. |
src/api/documentEnhancer.ts
Outdated
| return documents.map((doc) => { | ||
| const { content, ...docWithoutContent } = doc; |
There was a problem hiding this comment.
I prefer use map twice:
documents.map().map(etc)
There was a problem hiding this comment.
Refactored to use two map operations as requested in commit b1fa80b.
Co-authored-by: baruchiro <17686879+baruchiro@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR optimizes context window usage by excluding the content field from document queries by default, addressing performance issues when document text content isn't needed (e.g., during correspondent merge workflows).
Changes:
- Modified
documentEnhancer.tsto exclude thecontentfield from enhanced document responses using destructuring - Added
get_document_contenttool to retrieve document text content when specifically needed - Updated tool descriptions for
list_documents,get_document, andsearch_documentsto document the content exclusion behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/api/documentEnhancer.ts | Modified enhanceDocumentsArray to destructure and exclude the content field from returned documents, updated return type to Omit<EnhancedDocument, 'content'>[] |
| src/tools/documents.ts | Added new get_document_content tool to retrieve document text when needed; updated tool descriptions for list_documents, get_document, and search_documents to note content exclusion |
| .changeset/exclude-content-by-default.md | Added changeset file marking this as a minor version change with appropriate description |
Implementation Complete ✅
Simplified approach per feedback:
fieldsparameter complexity (no FieldFilterOptions, no field filtering logic)contentfrom all document responses by defaultget_document_contenttool to retrieve content when neededChanges Made
1. documentEnhancer.ts
enhanceDocumentsArray()to use two separate map operations:contentfield using destructuringPromise<Omit<EnhancedDocument, 'content'>[]>2. documents.ts
get_documentto just callconvertDocsWithNames(doc, api)get_document_contenttool that returns onlyid,title, andcontentlist_documents,get_document, andsearch_documentsto mention content exclusion and referenceget_document_content3. Changeset
Usage
Default behavior (content excluded):
Get content when needed:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Note
Optimizes document queries by removing heavy
contentpayloads from default responses and providing an explicit retrieval path when needed.documentEnhancer.tsto omitcontentfrom enhanced documents (type nowOmit<EnhancedDocument, 'content'>[])get_document_contenttool returning{ id, title, content }list_documents,get_document, andsearch_documentsto note content exclusionWritten by Cursor Bugbot for commit cde4cf3. This will update automatically on new commits. Configure here.