Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

openai-apps-sdk

БесплатноБез исполняемых скриптовНе проверен

This skill should be used when building ChatGPT apps with the OpenAI Apps SDK — the window.openai bridge, openai/* _meta fields and their MCP Apps…

TheLobbiот TheLobbi★ 22 звезды на GitHub

Об этом скилле

OpenAI Apps SDK

ChatGPT implements MCP Apps. The Apps SDK is MCP Apps plus ChatGPT-only extensions. Build on the standard first; reach for window.openai only for capabilities the standard does not cover.

Prefer the shared field, every time

Goal MCP Apps standard (use this) ChatGPT alias (legacy)
Link tool → UI resource _meta.ui.resourceUri _meta["openai/outputTemplate"]
Receive tool input ui/initialize + ui/notifications/tool-input window.openai.toolInput
Receive tool result ui/notifications/tool-result window.openai.toolOutput
Call a tool from the UI tools/call window.openai.callTool
Send a follow-up message ui/message window.openai.sendFollowUpMessage
Update model-visible context ui/update-model-context (no alias — use the standard)

The aliases still work for existing integrations. New code uses the middle column, which also runs in Claude and M365 Copilot unchanged.

ChatGPT-only extensions

These have no MCP Apps equivalent. They are the only legitimate reason to touch window.openai.

API Purpose
requestCheckout(session) Embedded ChatGPT payment sheet (private beta).
uploadFile(file) User file upload.
selectFiles() Prompt the user to pick files.
getFileDownloadUrl({ fileId }) Resolve a file ID to a URL.
requestModal(opts) Host-controlled modal.
widgetState / setWidgetState(state) Widget-scoped ephemeral persistence.

Feature-detect, never host-detect

const openai = typeof window !== "undefined" ? window.openai : undefined;

if (openai?.requestModal) {
  await openai.requestModal({ /* … */ });
} else {
  // Inline fallback that works everywhere.
}

Branching on host name (if (isChatGPT)) breaks the moment another host adds the capability, or ChatGPT ships it to a subset of surfaces. Test for the capability you need.

Tool descriptor _meta

_meta: {
  ui: { resourceUri: TEMPLATE_URI },              // portable
  "openai/toolInvocation/invoking": "Rolling…",   // ChatGPT status text
  "openai/toolInvocation/invoked": "Rolled.",
  "openai/widgetAccessible": true,                // UI may call this tool
  "openai/visibility": ["model", "app"],
  "openai/fileParams": ["attachment"],            // params that accept file IDs
}

Resource _meta

_meta: {
  ui: {
    prefersBorder: true,
    domain: "https://example.com",
    csp: {
      connectDomains: ["https://api.example.com"],
      resourceDomains: ["https://static.example.com"],
      frameDomains: [],                            // nested frames blocked by default
    },
  },
  "openai/widgetDescription": "Shows the project board.",
}

The decoupled data/render pattern

This is the single highest-leverage design decision in an Apps SDK server.

Problem: attach a template to every tool and ChatGPT re-renders (and remounts) the iframe on every call, destroying local state and burning latency.

Solution: split the tools.

  • Data tools — fetch/compute/mutate. Return structuredContent only. No resourceUri.
  • Render tools — take already-prepared data and return the template. Only these carry _meta.ui.resourceUri.
const TEMPLATE_URI = "ui://widget/dice.html";

// 1) Data tool — chainable, no template.
server.registerTool("roll_dice", {
  title: "Roll dice",
  description: "Roll an N-sided die and return { sides, value }.",
  inputSchema: { sides: z.number().int().min(2) },
  outputSchema: { sides: z.number().int().min(2), value: z.number().int().min(1) },
  _meta: {
    "openai/toolInvocation/invoking": "Rolling…",
    "openai/toolInvocation/invoked": "Rolled.",
  },
}, async ({ sides }) => {
  const value = 1 + Math.floor(Math.random() * sides);
  return {
    structuredContent: { sides, value },
    content: [{ type: "text", text: `Rolled ${value} on ${sides} sides.` }],
  };
});

// 2) Render tool — owns the template, depends on the data tool.
server.registerTool("render_dice_widget", {
  title: "Render dice widget",
  description:
    "Render the dice widget from roll data. First call roll_dice, then pass its sides and value here.",
  inputSchema: { sides: z.number().int().min(2), value: z.number().int().min(1) },
  _meta: { ui: { resourceUri: TEMPLATE_URI } },
}, async ({ sides, value }) => ({
  structuredContent: { sides, value },
  content: [{ type: "text", text: `Showing a ${sides}-sided roll: ${value}.` }],
}));

Call flow: model calls roll_dice → inspects structuredContent → refines → calls render_dice_widget → widget renders once with model-checked data.

The payoff is more than performance. When the user asks a follow-up the server cannot express as a filter ("which of these are in the Richmond school zone?"), the model narrows the candidate set itself and renders only the survivors.

Rules:

  • State the dependency in the render tool's description explicitly.
  • Keep data
Полный SKILL.md на GitHub

Установить openai-apps-sdk в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл openai-apps-sdk?

This skill should be used when building ChatGPT apps with the OpenAI Apps SDK — the window.openai bridge, openai/* _meta fields and their MCP Apps equivalents, widget state, display modes, the decoupled data/render tool pattern, checkout, file handling, and the esbuild component bundle.

Как установить скилл openai-apps-sdk?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл openai-apps-sdk запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить openai-apps-sdk с