bear-notes-mcp 2.8.0 → 2.8.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/config.js +1 -1
- package/dist/main.js +21 -5
- package/dist/notes.js +7 -14
- package/package.json +1 -1
package/dist/config.js
CHANGED
package/dist/main.js
CHANGED
|
@@ -52,11 +52,27 @@ Use bear-search-notes to find the correct note identifier.`);
|
|
|
52
52
|
`ID: ${noteWithContent.identifier}`,
|
|
53
53
|
];
|
|
54
54
|
const noteText = noteWithContent.text || '*This note appears to be empty.*';
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
const annotations = { audience: ['user', 'assistant'] };
|
|
56
|
+
// Body and file metadata are separate content blocks so the synthetic
|
|
57
|
+
// file section can never leak back during write operations (#86)
|
|
58
|
+
const content = [
|
|
59
|
+
{
|
|
60
|
+
type: 'text',
|
|
61
|
+
text: `${noteInfo.join('\n')}\n\n---\n\n${noteText}`,
|
|
62
|
+
annotations,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
if (noteWithContent.files?.length) {
|
|
66
|
+
const fileEntries = noteWithContent.files
|
|
67
|
+
.map((f) => `## ${f.filename}\n\n${f.content}`)
|
|
68
|
+
.join('\n\n---\n\n');
|
|
69
|
+
content.push({
|
|
70
|
+
type: 'text',
|
|
71
|
+
text: `# Attached Files\n\n${fileEntries}`,
|
|
72
|
+
annotations,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return { content };
|
|
60
76
|
}
|
|
61
77
|
catch (error) {
|
|
62
78
|
logger.error('bear-open-note failed:', error);
|
package/dist/notes.js
CHANGED
|
@@ -91,8 +91,9 @@ export function getNoteContent(identifier) {
|
|
|
91
91
|
// Process multiple rows (note + files) into single note object
|
|
92
92
|
const firstRow = rows[0];
|
|
93
93
|
const formattedNote = formatBearNote(firstRow);
|
|
94
|
-
// Collect file content
|
|
95
|
-
|
|
94
|
+
// Collect file content into a structured array — kept separate from note text
|
|
95
|
+
// to prevent the synthetic file section from leaking into write operations (#86)
|
|
96
|
+
const files = [];
|
|
96
97
|
for (const row of rows) {
|
|
97
98
|
const rowData = row;
|
|
98
99
|
const filename = rowData.filename;
|
|
@@ -102,21 +103,13 @@ export function getNoteContent(identifier) {
|
|
|
102
103
|
const content = trimmed
|
|
103
104
|
? trimmed
|
|
104
105
|
: '*[File content not available — Bear has not extracted text from this file type]*';
|
|
105
|
-
|
|
106
|
+
files.push({ filename, content });
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const filesSectionHeader = '\n\n---\n\n#Attached Files\n\n';
|
|
111
|
-
if (fileContents.length > 0) {
|
|
112
|
-
const fileSection = `${filesSectionHeader}${fileContents.join('\n\n---\n\n')}`;
|
|
113
|
-
formattedNote.text = originalText + fileSection;
|
|
109
|
+
if (files.length > 0) {
|
|
110
|
+
formattedNote.files = files;
|
|
114
111
|
}
|
|
115
|
-
|
|
116
|
-
// Add a note that no files are attached for clarity
|
|
117
|
-
formattedNote.text = originalText + `${filesSectionHeader}*No files attached to this note.*`;
|
|
118
|
-
}
|
|
119
|
-
logger.info(`Retrieved note content with ${fileContents.length} attached files for: ${formattedNote.title}`);
|
|
112
|
+
logger.info(`Retrieved note content with ${files.length} attached files for: ${formattedNote.title}`);
|
|
120
113
|
return formattedNote;
|
|
121
114
|
}
|
|
122
115
|
catch (error) {
|