一键导入
resource-design
Design MCP resources to expose content for LLM consumption. Use when creating static or dynamic resources in xmcp.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design MCP resources to expose content for LLM consumption. Use when creating static or dynamic resources in xmcp.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create a new xmcp tool with schema, metadata, and handler. Use when the user wants to add a new tool to their xmcp project.
Guide for designing effective MCP servers with agent-friendly tools. Use when creating a new MCP server, designing MCP tools, or improving existing MCP server architecture.
Design MCP prompts to expose reusable prompt templates. Use when creating parameterized prompts in xmcp.
Best practices for designing UI widgets in xmcp. Use when creating interactive widgets for GPT Apps or MCP Apps, choosing between React components and template literals, designing widget layouts, handling state and data fetching, or troubleshooting widget rendering issues.
| name | resource-design |
| description | Design MCP resources to expose content for LLM consumption. Use when creating static or dynamic resources in xmcp. |
You are helping the user create a new xmcp resource. Follow this interactive workflow.
Before generating any code, ask the user these questions using AskUserQuestion:
Resource name (if not provided): What should the resource be named? (Use kebab-case)
Resource type: Ask which type of resource they need:
URI pattern: How should the resource be accessed?
config://app or docs://readmeusers://[userId]/profilereports://[year]/[month]/summaryContent details:
Widget support (optional): Ask if they need OpenAI widget rendering.
Create the resource file in src/resources/ following the routing conventions:
Resources use file-based routing similar to Next.js:
src/resources/
├── (config)/ # Route group (not in URI)
│ └── app.ts # → config://app
├── (users)/
│ └── [userId]/ # Dynamic segment
│ └── profile.ts # → users://[userId]/profile
└── docs/
└── readme.ts # → docs://readme
Routing conventions:
(folder) - Route group, excluded from URI path[param] - Dynamic parameter segmentEvery xmcp resource has two main exports:
// 1. Metadata (optional) - Resource configuration
export const metadata: ResourceMetadata = { /* ... */ };
// 2. Handler (required) - Default export function
export default function handler(params?) { /* ... */ }
// 3. Schema (optional) - For dynamic resources with parameters
export const schema = { /* ... */ };
import { type ResourceMetadata } from "xmcp";
// For dynamic resources
import { z } from "zod";
import { type InferSchema, type ResourceMetadata } from "xmcp";
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No* | Unique resource identifier |
title | string | No | Human-readable title |
description | string | No | What this resource provides |
mimeType | string | No | Content type (default: text/plain) |
size | number | No | Content size in bytes |
_meta | object | No | Vendor extensions (OpenAI, etc.) |
*When metadata is omitted, xmcp uses the filename as the resource name.
| Return Type | Use Case |
|---|---|
string | Simple text content |
{ text: string } | Explicit text content |
{ blob: Uint8Array, mimeType: string } | Binary content |
JSON.stringify(data) | JSON content |
For complete code templates including:
Read: references/patterns.md
src/resources/ locationname and description.describe() for all parameters (if dynamic)Suggest running pnpm build to verify the resource compiles correctly.