Skip to content

Clarify MCP conversationId uniqueness guidance - #108

Merged
kentcdodds merged 2 commits into
mainfrom
cursor/conversation-id-uniqueness-instructions-cfe3
Mar 31, 2026
Merged

kentcdodds merged 2 commits into
mainfrom
cursor/conversation-id-uniqueness-instructions-cfe3

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Mar 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • clarify MCP tool instructions to tell clients to generate short random conversationId values that attempt to avoid collisions
  • align the shared conversationId schema description with the top-level MCP server instructions
  • dedupe repeated MCP conversationId guidance in packages/worker/src/mcp/index.ts via a shared exported constant

Testing

  • npm run test:mcp

Summary by CodeRabbit

  • Documentation
    • Updated MCP server instructions to clarify conversationId handling: clients should generate and reuse short random values, and Kody returns generated conversationIds in responses when omitted.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Documentation
    • Updated MCP server instructions to clarify conversationId handling: clients should generate and reuse short random values, and Kody returns generated conversationIds in responses when omitted.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Updated MCP server documentation and descriptions across two files to specify that clients should generate and reuse short random conversationId values to avoid collisions, with Kody generating and returning a short random value if omitted. No code logic or API changes were made.

Changes

Cohort / File(s) Summary
MCP Server Documentation
packages/worker/src/mcp/index.ts
Updated inline instructions across "Quick start", "How to use search", "How to use execute", and "MCP App tools" sections to clarify that clients should generate short random conversationId values and that Kody returns the generated ID in structuredContent.conversationId if omitted.
Tool Call Context Description
packages/worker/src/mcp/tools/tool-call-context.ts
Updated conversationIdDescription string to reflect that clients should provide short random values for collision avoidance, and that Kody generates a short random value when omitted.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A random ID hops along the way,
Short and bouncy, it won't go astray!
Kody catches those that slip through the cracks,
Less confusion now on the conversation tracks! 🎯

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: updating MCP documentation to clarify how conversationId should be generated and used for uniqueness.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/conversation-id-uniqueness-instructions-cfe3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kentcdodds
kentcdodds marked this pull request as ready for review March 30, 2026 23:46
@github-actions

github-actions Bot commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-108.kentcdodds.workers.dev

Worker: kody-pr-108
D1: kody-pr-108-db
KV: kody-pr-108-oauth-kv

Mocks:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/worker/src/mcp/index.ts (1)

35-35: Consider centralizing the repeated conversationId instruction text.

Lines 35, 54, 84, and 105 duplicate near-identical wording. Extracting a shared constant (like conversationIdGuidance) would reduce doc drift risk.

♻️ Suggested refactor
+const conversationIdGuidance =
+  "Optionally pass `conversationId` and reuse it on later related tool calls. Generate short random values that attempt to avoid collisions. If omitted, Kody generates a short random value and returns it in `structuredContent.conversationId`."
...
-- Optionally pass `conversationId` and reuse it on later related tool calls. Generate short random values that attempt to avoid collisions. If omitted, Kody generates a short random value and returns it in `structuredContent.conversationId`.
+- ${conversationIdGuidance}

Also applies to: 54-54, 84-84, 105-105

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/worker/src/mcp/index.ts` at line 35, Extract the duplicated
"conversationId" instruction string in packages/worker/src/mcp/index.ts into a
single exported constant (e.g., conversationIdGuidance) and replace the repeated
inline texts at the four occurrences with that constant; update any local
references in the same module to use conversationIdGuidance and export it if
other modules consume the guidance so callers still receive identical wording.
Ensure the constant contains the exact original wording including mention of
optional conversationId and memoryContext, and run/adjust any tests or callers
that compare the text to reference the new constant instead of the hardcoded
string.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/worker/src/mcp/index.ts`:
- Line 35: Extract the duplicated "conversationId" instruction string in
packages/worker/src/mcp/index.ts into a single exported constant (e.g.,
conversationIdGuidance) and replace the repeated inline texts at the four
occurrences with that constant; update any local references in the same module
to use conversationIdGuidance and export it if other modules consume the
guidance so callers still receive identical wording. Ensure the constant
contains the exact original wording including mention of optional conversationId
and memoryContext, and run/adjust any tests or callers that compare the text to
reference the new constant instead of the hardcoded string.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a0fc87d1-549c-4578-80d4-b8126d2872f4

📥 Commits

Reviewing files that changed from the base of the PR and between 38aaba0 and bd8eb54.

📒 Files selected for processing (2)
  • packages/worker/src/mcp/index.ts
  • packages/worker/src/mcp/tools/tool-call-context.ts

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds
kentcdodds merged commit b58776d into main Mar 31, 2026
9 checks passed
@kentcdodds
kentcdodds deleted the cursor/conversation-id-uniqueness-instructions-cfe3 branch March 31, 2026 02:35
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.

2 participants