diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 81f776ab..1824ee5a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,8 +15,9 @@ We welcome contributions to the MCP Apps SDK! This document outlines the process 1. Create a new branch for your changes 2. Make your changes 3. Run `npm run prettier` to ensure code style compliance -4. Run `npm test` to verify all tests pass -5. Submit a pull request +4. If running prettier fails, run `npm run prettier:fix` to fix +5. Run `npm test` to verify all tests pass +6. Submit a pull request ## Pull Request Guidelines diff --git a/src/app-bridge.test.ts b/src/app-bridge.test.ts index 66d5f830..89c5458a 100644 --- a/src/app-bridge.test.ts +++ b/src/app-bridge.test.ts @@ -844,16 +844,6 @@ describe("getToolUiResourceUri", () => { }); }); - describe("deprecated flat format (_meta['ui/resourceUri'])", () => { - it("extracts resourceUri from deprecated format", () => { - const tool = { - name: "test-tool", - _meta: { "ui/resourceUri": "ui://server/app.html" }, - }; - expect(getToolUiResourceUri(tool)).toBe("ui://server/app.html"); - }); - }); - describe("format precedence", () => { it("prefers new nested format over deprecated format", () => { const tool = { diff --git a/src/app-bridge.ts b/src/app-bridge.ts index 079dc705..62fad9ae 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -80,7 +80,6 @@ import { } from "./types"; export * from "./types"; export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE } from "./app"; -import { RESOURCE_URI_META_KEY } from "./app"; export { PostMessageTransport } from "./message-transport"; /** @@ -100,12 +99,6 @@ export { PostMessageTransport } from "./message-transport"; * const uri = getToolUiResourceUri({ * _meta: { ui: { resourceUri: "ui://server/app.html" } } * }); - * - * // Deprecated flat format (still supported) - * const uri = getToolUiResourceUri({ - * _meta: { "ui/resourceUri": "ui://server/app.html" } - * }); - * ``` */ export function getToolUiResourceUri(tool: { _meta?: Record; @@ -114,15 +107,12 @@ export function getToolUiResourceUri(tool: { const uiMeta = tool._meta?.ui as { resourceUri?: unknown } | undefined; let uri: unknown = uiMeta?.resourceUri; - // Fall back to deprecated flat format: _meta["ui/resourceUri"] - if (uri === undefined) { - uri = tool._meta?.[RESOURCE_URI_META_KEY]; - } - if (typeof uri === "string" && uri.startsWith("ui://")) { return uri; } else if (uri !== undefined) { - throw new Error(`Invalid UI resource URI: ${JSON.stringify(uri)}`); + throw new Error( + `Invalid UI resource URI: ${JSON.stringify(uri)}. URI must be a string and start with "ui://"`, + ); } return undefined; }