Skip to content

fix(mcp): keep tag values verbatim in nostr_publish_event - #558

Merged
tcheeric merged 2 commits into
mainfrom
fix/mcp-verbatim-tags
Sep 25, 2026
Merged

tcheeric merged 2 commits into
mainfrom
fix/mcp-verbatim-tags

Conversation

@tcheeric

Copy link
Copy Markdown
Owner

Summary

nostr_publish_event dropped empty tag values and trimmed the others. NIP-01 tags are positional, so ["p", pk, "", "mention"] was signed and published as ["p", pk, "mention"]: the marker landed in the relay-hint slot, and the event that went out was not the one previewed for approval.

Found in production: a NIP-84 highlight's recomputed id didn't match the approved event file, and diffing the live event against it showed the shifted p tag.

Type of change

  • fix - Bug fix (non-breaking)
  • test - Adding or updating tests
  • chore - Build, CI, or tooling changes (version bump to 2.4.1)

What changed?

  • ToolArguments.nestedTexts() reused texts(), which trims values and filters out empty strings. That is right for flat lists (ids, relays), wrong for tags. It now maps inner values with String::valueOf and nothing else. texts() is unchanged for its other callers.
  • nestedTexts() has one caller, PublishEventTool, so nothing else is affected.
  • New ToolArgumentsTest: empty values keep their position, values aren't trimmed, and the flat-tag path behaves the same.
  • Release: all modules 2.4.0 → 2.4.1, CHANGELOG [2.4.1] section, docs version reference.

Testing

  • Unit tests pass: mvn clean test (the three new tests failed before the fix)
  • Integration tests pass: mvn verify (requires Docker), not run locally
  • Installed the rebuilt jar as the local MCP server.

Review focus

Targets main rather than develop, matching #557: develop is still at 2.3.1 and doesn't contain 2.4.0.

Checklist

  • PR title follows conventional commits: type(scope): description
  • Changes are focused and under 300 lines
  • Tests added/updated
  • No new compiler warnings introduced
  • CHANGELOG.md updated

🤖 Generated with Claude Code

tcheeric and others added 2 commits September 25, 2026 16:52
nestedTexts reused texts(), which trims values and drops empty ones.
Tags are positional, so ["p", pk, "", "mention"] went out as
["p", pk, "mention"], moving the marker into the relay-hint slot.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- nostr-java (all modules): 2.4.0 → 2.4.1 (patch) [maven]

Fixed: nostr_publish_event dropped empty tag values and trimmed the
rest, so positional tags like ["p", pk, "", "mention"] shifted.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@tcheeric
tcheeric merged commit b44d487 into main Sep 25, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant