taliawedged117/census-mcp-server/add-resource
Claude Code and agent skill by taliawedged117/census-mcp-server
- community
Checking that the SKILL.md file is still in the repository.
Scaffold a new MCP resource definition. Use when the user asks to add a resource, expose data via URI, or create a readable endpoint.
Install
npx vskill@latest install taliawedged117/census-mcp-server/add-resourceSKILL.md
The same SKILL.md was published earlier as ficaviolaodorata520/met-museum-mcp-server/add-resource.
Context
Resources use the resource() builder from @cyanheads/mcp-ts-core. Each resource lives in src/mcp-server/resources/definitions/ with a .resource.ts suffix. The standard registration pattern uses a definitions/index.ts barrel that collects all resources into an allResourceDefinitions array for createApp(). Fresh scaffolds start with direct imports in src/index.ts — the barrel is introduced as definitions grow. Match the pattern already used by the project you're editing.
Tool coverage. Not all MCP clients expose resources — many are tool-only (Claude Code, Cursor, most chat UIs). Before adding a resource, verify the same data is reachable via the tool surface — either through a dedicated tool, included in another tool's output, or bundled into a broader tool. A resource whose data has no tool path is invisible to a large share of agents.
Steps
- Gather the resource's URI template, purpose, and data shape from the user's request — ask only if genuinely absent
- Design the URI — use
{paramName}for path parameters (e.g.,myscheme://{itemId}/data) - Create the file at
src/mcp-server/resources/definitions/{{resource-name}}.resource.ts - Register the resource in the project's existing
createApp()resource list (directly insrc/index.tsfor fresh scaffolds, or via a barrel if the repo already has one) - Run `bun run devcheck` to verify
- Smoke-test with
bun run rebuild && bun run start:stdio(orstart:http)
Template
With pagination
For resources that return large result sets, include cursor in the URI template params and use opaque cursor pagination in the handler. The cursor arrives as a validated URI param. paginateArray requires a RequestContext for logging — create one from requestContextService:
Registration
If the repo already uses src/mcp-server/resources/definitions/index.ts, add the export to that barrel instead:
Optional: declarative errors[] contract
Resources can opt into the same typed error contract as tools — bound to a typed ctx.fail(reason, …) keyed by the declared reason union:
Without errors[], the handler receives plain Context (no fail method) and throws via error factories (notFound, serviceUnavailable, …) directly. The contract is opt-in. See skills/api-errors/SKILL.md for the full pattern, baseline codes, and conformance rules.
Other resource() options
Beyond description, params, handler, and list, the builder also supports:
| Field | Purpose | |
|---|---|---|
name | Short human-readable name for resources/list. Defaults to a slug derived from the URI template if omitted. | |
output | Optional Zod schema for runtime validation of the handler return value (parity with tool()'s output). | |
format | Optional formatter mapping the handler's return to the ReadResourceResult.contents[] shape. Default: string passthrough; objects serialized to JSON. Override when you need to attach permissions, custom encodings, or split into multiple content items. | |
annotations | Resource annotations (e.g., audience, priority) — see ResourceAnnotations. | |
title | Human-readable display title (defaults to name). | |
examples | Array of { name, uri } example entries surfaced in resources/list for discoverability. |
Checklist
- [ ] File created at
src/mcp-server/resources/definitions/{{resource-name}}.resource.ts - [ ] Resource name passed to
resource()uses a valid URI template with{paramName}syntax - [ ] All Zod
paramsfields have.describe()annotations - [ ]
outputschema added if the handler returns structured data that benefits from runtime validation - [ ] JSDoc
@fileoverviewand@moduleheader present - [ ]
handler(params, ctx)is pure — throws on failure, no try/catch - [ ] If
errors[]contract declared: every entry has arecoveryfield (≥5 words, lint-enforced) - [ ] Data is reachable via the tool surface — confirm by checking
src/mcp-server/tools/definitions/for a tool that exposes this data, or document why this resource is resources-only - [ ]
list()function provided if the resource is discoverable - [ ] Pagination used for large result sets (
extractCursor/paginateArray) — applies to bothhandlerdata andlist()catalogs with many entries - [ ] Registered in the project's existing
createApp()resource list (directly or via barrel) - [ ]
bun run devcheckpasses - [ ] Smoke-tested with
bun run rebuild && bun run start:stdio(orstart:http)
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/add-resource/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/taliawedged117/census-mcp-server/add-resource)