fix(talk): address PR #741 reviewer feedback

Four targeted fixes from the AI code review:

1. TalkConversation.description: drop the misleading `str | None`
   union (spreed always sends `""`, never null) — type is now `str`
   with default `""`.

2. get_messages: guard the X-Chat-Last-Given int parse with
   try/except so a misbehaving proxy can't crash the read flow;
   logs a warning and falls back to None.

3. get_messages: clamp `limit` to [1, 200] in the client (spreed
   caps server-side at 200 and silently truncates) so the returned
   `count` always matches what was actually requested. Both client
   and server-tool docstrings updated to state the valid range.

4. Add an integration test covering the 32000-char message ceiling
   in talk_send_message — the empty-message case was already tested,
   the over-length case was not.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-04-30 00:03:24 +02:00
co-authored by Claude Opus 4.7
parent 69814f30e3
commit b6eb7a6bb8
4 changed files with 41 additions and 6 deletions
+15
View File
@@ -141,3 +141,18 @@ async def test_talk_send_message_validation_empty_text(
"talk_send_message", {"token": token, "message": ""}
)
assert result.isError is True, "Expected validation error for empty message"
async def test_talk_send_message_validation_too_long(
nc_mcp_client: ClientSession, temporary_conversation: dict
):
"""A message exceeding the 32000-char ceiling is rejected client-side."""
token = temporary_conversation["token"]
result = await nc_mcp_client.call_tool(
"talk_send_message",
{"token": token, "message": "x" * 32001},
)
assert result.isError is True, (
"Expected validation error for message longer than 32000 characters"
)