Skip to content

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

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

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

Conversation

@Thomas-Sedhom
Copy link
Copy Markdown
Contributor

Replaces #129 (closed by stale bot)

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:

566223208-5809d692-2ec0-41ef-bdcf-765f0d249ed0

Fixes: #128

@Thomas-Sedhom Thomas-Sedhom changed the title fix: prevent Agreement.uri from overriding resource URIFix/mcp resource uri override fix: prevent Agreement.uri from overriding resource URI Apr 14, 2026
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.

Agreement.uri field overrides the resource URI in getAgreements

1 participant