From 8059a3d120dce9b0a5bedff0ca1cfc89f1f25099 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Wed, 1 Jul 2026 19:23:57 -0400 Subject: [PATCH] docs(test-servers): note custom resource handlers must re-add _meta Address round-3 code-review note on PR #1587: resource `_meta` is applied only by the default read handler; a customHandler from onRegisterResource replaces the contents wholesale and would drop it. Document this on ResourceDefinition._meta so a future App UI resource with a custom read handler knows to re-add _meta itself. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01S3fTN8H3R8YV4yUGvZjYnX --- test-servers/src/composable-test-server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test-servers/src/composable-test-server.ts b/test-servers/src/composable-test-server.ts index 67bc7609..c8627ffc 100644 --- a/test-servers/src/composable-test-server.ts +++ b/test-servers/src/composable-test-server.ts @@ -127,7 +127,10 @@ export interface ResourceDefinition { description?: string; mimeType?: string; text?: string; - /** Included on the returned content item so clients can read resource-level `_meta` (e.g. `_meta.ui.csp` for MCP App UI resources). */ + /** + * Included on the returned content item so clients can read resource-level `_meta` (e.g. `_meta.ui.csp` for MCP App UI resources). + * Only the default read handler applies this; a `customHandler` from `config.onRegisterResource` replaces the `contents` wholesale, so such a handler must re-add `_meta` itself if the resource needs it on the read response. + */ _meta?: Record; }