Skip to content

Commit 949fb71

Browse files
committed
fix(notes): Remove note contents from responses to reduce token usage
1 parent 53b11f7 commit 949fb71

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

nextcloud_mcp_server/models/notes.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ class NotesSettings(BaseModel):
4848
class CreateNoteResponse(IdResponse):
4949
"""Response model for note creation."""
5050

51-
note: Note = Field(description="The created note")
51+
title: str = Field(description="The created note title")
52+
category: str = Field(description="The created note category")
5253

5354

5455
class UpdateNoteResponse(BaseResponse):
5556
"""Response model for note updates."""
5657

57-
note: Note = Field(description="The updated note")
58+
id: int = Field(description="The updated note ID")
59+
title: str = Field(description="The updated note title")
60+
category: str = Field(description="The updated note category")
5861

5962

6063
class DeleteNoteResponse(StatusResponse):
@@ -66,7 +69,9 @@ class DeleteNoteResponse(StatusResponse):
6669
class AppendContentResponse(BaseResponse):
6770
"""Response model for appending content to a note."""
6871

69-
note: Note = Field(description="The updated note after appending content")
72+
id: int = Field(description="The updated note ID")
73+
title: str = Field(description="The updated note title")
74+
category: str = Field(description="The updated note category")
7075

7176

7277
class SearchNotesResponse(BaseResponse):

nextcloud_mcp_server/server/notes.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ async def nc_notes_create_note(
9090
category=category,
9191
)
9292
note = Note(**note_data)
93-
return CreateNoteResponse(id=note.id, note=note)
93+
return CreateNoteResponse(
94+
id=note.id, title=note.title, category=note.category
95+
)
9496
except HTTPStatusError as e:
9597
if e.response.status_code == 403:
9698
return ErrorResponse(
@@ -128,7 +130,9 @@ async def nc_notes_update_note(
128130
category=category,
129131
)
130132
note = Note(**note_data)
131-
return UpdateNoteResponse(note=note)
133+
return UpdateNoteResponse(
134+
id=note.id, title=note.title, category=note.category
135+
)
132136
except HTTPStatusError as e:
133137
if e.response.status_code == 404:
134138
return ErrorResponse(error=f"Note {note_id} not found")
@@ -151,15 +155,17 @@ async def nc_notes_update_note(
151155
async def nc_notes_append_content(
152156
note_id: int, content: str, ctx: Context
153157
) -> AppendContentResponse | ErrorResponse:
154-
"""Append content to an existing note with a clear separator"""
158+
"""Append content to an existing note with a clear separator. The tool automatically adds separators between existing and new content - do not include separators in your content."""
155159
logger.info("Appending content to note %s", note_id)
156160
client: NextcloudClient = ctx.request_context.lifespan_context.client
157161
try:
158162
note_data = await client.notes.append_content(
159163
note_id=note_id, content=content
160164
)
161165
note = Note(**note_data)
162-
return AppendContentResponse(note=note)
166+
return AppendContentResponse(
167+
id=note.id, title=note.title, category=note.category
168+
)
163169
except HTTPStatusError as e:
164170
if e.response.status_code == 404:
165171
return ErrorResponse(error=f"Note {note_id} not found")

0 commit comments

Comments
 (0)