-
Notifications
You must be signed in to change notification settings - Fork 214
feat(mcp): add workspace parameter to write_note for parity with edit_note #964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+132
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,6 +109,7 @@ | |
| "content", | ||
| "directory", | ||
| "project", | ||
| "workspace", | ||
| "project_id", | ||
| "tags", | ||
| "note_type", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When callers use the newly advertised
workspaceparameter with a workspace name or tenant_id, this helper concatenates that raw value intoworkspace/project, butget_project_client()later routes qualified project identifiers throughresolve_workspace_project_identifier(), which matches the first segment only againstWorkspaceInfo.slug(project_context.pylines 819-827). In cloud workspaces where the slug differs from the display name or tenant UUID,write_note(workspace=<name-or-tenant_id>, project=...)now fails with “Workspace ... was not found” even though the docstring says those identifiers are accepted; resolve the workspace identifier to its slug/tenant before building the route or restrict the accepted input to slugs.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch on the resolver behavior, and the technical analysis is exactly right:
resolve_workspace_project_identifier()(project_context.py:819-827) matches the first segment of a composedworkspace/projectroute only againstWorkspaceInfo.slug(casefold), with no fallback to the displaynameortenant_id. So a composed route built from a name or tenant UUID does fail with "Workspace ... was not found", and the "slug, name, or tenant_id" wording over-promises.One scope note before fixing it here: that wording is not new in this PR. It is byte-for-byte identical to the already-shipped
edit_note— both the docstring (edit_note.py:368,write_note.py:126) and the_compose_*ValueError (edit_note.py:149,write_note.py:42) carry the same text. This PR's explicit goal is parity withedit_note, so correcting onlywrite_notewould make the two tools diverge for the same underlying behavior.Since the inaccuracy affects
edit_noteequally, the right fix is a follow-up that touches both tools together — either tightening the docstring/error wording to "workspace slug" or teaching the resolver to accept names/tenant_ids (real resolution logic, also shared). Keeping this PR as a faithful copy and addressing both tools in one follow-up avoids divergence. Leaving the code unchanged here for that reason.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in follow-up PR #979 (#979): rather than walking back the docs,
resolve_workspace_project_identifier()now resolves the workspace segment by slug (casefold), then tenant_id (exact), then display name (casefold), with fail-fast ambiguity handling on non-unique names and slug-owner precedence. This makes the documented "slug, name, or tenant_id" contract real foredit_notetoday and forwrite_noteonce this PR merges. Scoped to the resolver + tests so it does not conflict with this branch.