fix: prevent Agreement.uri from overriding MCP resource URI in getAgreements#155
fix: prevent Agreement.uri from overriding MCP resource URI in getAgreements#155JayDS22 wants to merge 1 commit into
Conversation
|
This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
|
@github-actions unstale |
|
This PR is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
|
This PR is stale because it has been open with no activity. Remove the stale label or comment to keep it active. Only items with maintainer engagement are auto-closed. |
|
@github-actions unstale |
|
this cannot merge with 153, I bring to bring the test file from #153's branch into this one |
|
Sounds good. Happy to do the lift: I'll cherry-pick |
d9168ba to
e13b77f
Compare
|
Force-pushed a rebase onto current main (d9168ba → e13b77f). The branch was stale (based on af4c9a0, pre-#154/#171/#176), so the rebase also dropped unintended drift in templates.ts, workflow YAML, and lockfiles, that also explains the previous Windows 20.x failure (was npm ci failing on a stale lockfile in ~12s). Diff is now purely server/handlers/mcp.ts (+56/−14). Local jest green (39/39). Heads-up on the new Windows red check, it's unrelated to this PR and pre-existing on main. The failure is in root npm run build at npx reslate build: Classic Windows-Node spawn gotcha in reslate.js. Same job is red on main's current HEAD (95105f5, run 26512754891) and on the two prior main runs back to early May; Linux + macOS green on all of them. Happy to open a separate PR for it. @niallroche @mttrbrts - could one of you approve the Build / Unit Tests matrix when you get a chance? Thanks. |
…eements The getAgreements function spread the full Agreement database row onto the MCP content object after setting the uri field. The row carries its own uri property, so JavaScript last-write-wins caused it to overwrite the apap:// resource URI with the agreement data URI. MCP clients then failed to resolve the resource. Removed the spread and constructed the content object with only the fields required by ReadResourceResult. Fixes accordproject#128 Signed-off-by: Jay Guwalani <guwalanijj@gmail.com>
e13b77f to
d3b1e2b
Compare
Summary
Fixes #128
Problem
In
server/handlers/mcp.ts, thegetAgreementsfunction built MCP contentobjects by setting
urifirst, then spreading...a(the full Agreementdatabase row) last. The Agreement row has its own
urifield, so the spreadoverwrote the MCP resource URI (
apap://agreements/{id}) with the agreement'sdata URI (
resource:org.accordproject...). MCP clients could not resolve theresource because they received the wrong URI scheme.
Additionally, spreading the entire row added unrelated database fields
(
template,state,agreementStatus, etc.) to the content object, whichonly expects
{ uri, mimeType, text }.Fix
Removed the
...aspread from the contents mapping. The agreement data isalready serialized inside the
textproperty. Placedurilast in theobject literal so the MCP resource URI always takes precedence.
How to test
apap://agreementsurilikeresource:org.accordproject...urilikeapap://agreements/1Discord: jayds22