@@ -340,21 +340,31 @@ export const EXTENSION_ID = "io.modelcontextprotocol/ui";
340340 * @returns The MCP Apps capability settings, or `undefined` if not supported
341341 *
342342 * @example Check for MCP Apps support in server initialization
343- * ```typescript
344- * import { getUiCapability, RESOURCE_MIME_TYPE, registerAppTool } from "@modelcontextprotocol/ext-apps/server";
345- *
346- * server.oninitialized = ({ clientCapabilities }) => {
343+ * ```ts source="./index.examples.ts#getUiCapability_checkSupport"
344+ * server.server.oninitialized = () => {
345+ * const clientCapabilities = server.server.getClientCapabilities();
347346 * const uiCap = getUiCapability(clientCapabilities);
347+ *
348348 * if (uiCap?.mimeTypes?.includes(RESOURCE_MIME_TYPE)) {
349- * registerAppTool(server, "weather", {
350- * description: "Get weather with interactive dashboard",
351- * _meta: { ui: { resourceUri: "ui://weather/dashboard" } },
352- * }, weatherHandler);
349+ * // App-enhanced tool
350+ * registerAppTool(
351+ * server,
352+ * "weather",
353+ * {
354+ * description: "Get weather information with interactive dashboard",
355+ * _meta: { ui: { resourceUri: "ui://weather/dashboard" } },
356+ * },
357+ * weatherHandler,
358+ * );
353359 * } else {
354- * // Register text-only fallback
355- * server.registerTool("weather", {
356- * description: "Get weather as text",
357- * }, textWeatherHandler);
360+ * // Text-only fallback
361+ * server.registerTool(
362+ * "weather",
363+ * {
364+ * description: "Get weather information",
365+ * },
366+ * textWeatherHandler,
367+ * );
358368 * }
359369 * };
360370 * ```
0 commit comments