Loading...
Loading...
Design MCP resources to expose content for LLM consumption. Use when creating static or dynamic resources in xmcp.
npx skill4agent add xmcp-dev/skills resource-designconfig://appdocs://readmeusers://[userId]/profilereports://[year]/[month]/summarysrc/resources/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(folder)[param]// 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 |
|---|---|---|---|
| string | No* | Unique resource identifier |
| string | No | Human-readable title |
| string | No | What this resource provides |
| string | No | Content type (default: text/plain) |
| number | No | Content size in bytes |
| object | No | Vendor extensions (OpenAI, etc.) |
| Return Type | Use Case |
|---|---|
| Simple text content |
| Explicit text content |
| Binary content |
| JSON content |
references/patterns.mdsrc/resources/namedescription.describe()pnpm build