You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,13 +102,19 @@ Each Nextcloud app has a corresponding server module that:
102
102
-**Important**: Integration tests run against live Docker containers. After making code changes to the MCP server, rebuild only the MCP container with `docker-compose up --build -d mcp` before running tests
103
103
104
104
#### Testing Best Practices
105
-
-**Always restart MCP server** after code changes with `docker-compose up --build -d mcp`
105
+
-**MANDATORY: Always run tests after implementing features or fixing bugs**
106
+
- Run tests to completion before considering any task complete
107
+
- If tests require modifications to pass, ask for permission before proceeding
108
+
- Use `docker-compose up --build -d mcp` to rebuild MCP container after code changes
106
109
-**Use existing fixtures** from `tests/conftest.py` to avoid duplicate setup work:
107
110
-`nc_mcp_client` - MCP client session for tool/resource testing
108
111
-`nc_client` - Direct NextcloudClient for setup/cleanup operations
109
112
-`temporary_note` - Creates and cleans up test notes automatically
110
113
-`temporary_addressbook` - Creates and cleans up test address books
111
114
-`temporary_contact` - Creates and cleans up test contacts
115
+
-**Test specific functionality** after changes:
116
+
- For Notes changes: `uv run pytest tests/integration/test_mcp.py -k "notes" -v`
117
+
- For specific API changes: `uv run pytest tests/integration/test_notes_api.py -v`
112
118
-**Avoid creating standalone test scripts** - use pytest with proper fixtures instead
returnErrorResponse(error=f"Note {note_id} not found")
151
+
raiseMcpError(ErrorData(code=-1, message=f"Note {note_id} not found"))
139
152
elife.response.status_code==412:
140
-
returnErrorResponse(
141
-
error=f"Note {note_id} has been modified by someone else. Please refresh and try again."
153
+
raiseMcpError(
154
+
ErrorData(
155
+
code=-1,
156
+
message=f"Note {note_id} has been modified by someone else. Please refresh and try again.",
157
+
)
142
158
)
143
159
elife.response.status_code==403:
144
-
returnErrorResponse(
145
-
error=f"Access denied: insufficient permissions to update note {note_id}"
160
+
raiseMcpError(
161
+
ErrorData(
162
+
code=-1,
163
+
message=f"Access denied: insufficient permissions to update note {note_id}",
164
+
)
146
165
)
147
166
elife.response.status_code==413:
148
-
returnErrorResponse(error="Updated note content is too large")
167
+
raiseMcpError(
168
+
ErrorData(code=-1, message="Updated note content is too large")
169
+
)
149
170
else:
150
-
returnErrorResponse(
151
-
error=f"Failed to update note {note_id}: server error ({e.response.status_code})"
171
+
raiseMcpError(
172
+
ErrorData(
173
+
code=-1,
174
+
message=f"Failed to update note {note_id}: server error ({e.response.status_code})",
175
+
)
152
176
)
153
177
154
178
@mcp.tool()
155
179
asyncdefnc_notes_append_content(
156
180
note_id: int, content: str, ctx: Context
157
-
) ->AppendContentResponse|ErrorResponse:
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."""
181
+
) ->AppendContentResponse:
182
+
"""Append content to an existing note. The tool adds a `\n---\n`
183
+
between the note and what will be appended."""
184
+
159
185
logger.info("Appending content to note %s", note_id)
0 commit comments