Skip to content

fix: prevent Agreement.uri from overriding resource URI#129

Closed
Thomas-Sedhom wants to merge 2 commits intoaccordproject:mainfrom
Thomas-Sedhom:fix/mcp-resource-uri-override
Closed

fix: prevent Agreement.uri from overriding resource URI#129
Thomas-Sedhom wants to merge 2 commits intoaccordproject:mainfrom
Thomas-Sedhom:fix/mcp-resource-uri-override

Conversation

@Thomas-Sedhom
Copy link
Copy Markdown
Contributor

@Thomas-Sedhom Thomas-Sedhom commented Mar 19, 2026

Problem

In getAgreements, the object spread ...a was placed after the explicitly defined uri field. Since Agreement has its own uri property, it was silently overwriting the apap://agreements/${a.id} URI we were trying to set — meaning MCP clients were getting the wrong URI back.

Solution

Moved ...a to the top of the returned object so that our explicit uri, mimeType, and text fields always take precedence over whatever's on the schema.

// before
return {
    uri: `apap://agreements/${a.id}`,   // overridden by ...a
    mimeType: "application/json",
    text: JSON.stringify({ ...a.data, $identifier: a.id }, null, 2),
    ...a
}

// after
return {
    ...a,
    uri: `apap://agreements/${a.id}`, 
    mimeType: "application/json",
    text: JSON.stringify({ ...a.data, $identifier: a.id }, null, 2),
}

And it finally return the correct URI:

image

Fixes: #128

Signed-off-by: thomas sedhom <thomassedhom97@gmail.com>
@Thomas-Sedhom Thomas-Sedhom force-pushed the fix/mcp-resource-uri-override branch from a69fdac to 8d776c9 Compare March 19, 2026 11:59
Signed-off-by: thomas sedhom <thomassedhom97@gmail.com>
@Thomas-Sedhom Thomas-Sedhom force-pushed the fix/mcp-resource-uri-override branch from f31df45 to b33fd50 Compare March 19, 2026 12:11
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2026

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.

@Thomas-Sedhom
Copy link
Copy Markdown
Contributor Author

This work has been continued in #164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agreement.uri field overrides the resource URI in getAgreements

1 participant