BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/pastecn/ai-sdk

Pastecn AI SDK Tools

pastecn/ai-sdk
FreeUtility

AI SDK tools for creating and reading pastecn snippets

Live preview

live · rendered by the registry
Rendered by pastecn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://pastecn.com/r/ai-sdk.json

Source

registry/tools/pastecn.tspastecn.com/r/ai-sdk.json
1import { tool } from "ai";
2import { z } from "zod";
3
4export const createSnippet = (options?: { baseUrl?: string }) =>
5 tool({
6 description: "Create a code snippet on pastecn and get a shareable URL",
7 inputSchema: z.object({
8 name: z.string().describe("Name of the snippet"),
9 type: z
10 .enum(["file", "component", "hook", "lib", "block"])
11 .describe("Type of snippet"),
12 files: z
13 .array(
14 z.object({
15 path: z
16 .string()
17 .describe('File path (e.g., "components/button.tsx")'),
18 content: z.string().describe("File content"),
19 target: z
20 .string()
21 .optional()
22 .describe("Target path for installation"),
23 })
24 )
25 .describe("Files to include in the snippet"),
26 password: z.string().optional().describe("Optional password protection"),
27 }),
28 execute: async ({ name, type, files, password }) => {
29 const baseUrl = options?.baseUrl ?? "https://pastecn.com";
30 const response = await fetch(`${baseUrl}/api/v1/snippets`, {
31 method: "POST",
32 headers: { "Content-Type": "application/json" },
33 body: JSON.stringify({ name, type, files, password }),
34 });
35
36 if (!response.ok) {
37 const error = await response.text();
38 throw new Error(error || "Failed to create snippet");
39 }
40
41 return response.json();
42 },
43 });
44
45export const getSnippet = (options?: { baseUrl?: string }) =>
46 tool({
47 description: "Retrieve a code snippet from pastecn by ID",
48 inputSchema: z.object({
49 id: z.string().describe("Snippet ID"),
50 password: z
51 .string()
52 .optional()
53 .describe("Password if snippet is protected"),
54 }),
55 execute: async ({ id, password }) => {
56 const baseUrl = options?.baseUrl ?? "https://pastecn.com";
57 const headers: Record<string, string> = {
58 "Content-Type": "application/json",
59 };
60
61 if (password) {
62 headers["Authorization"] = `Bearer ${password}`;
63 }
64
65 const response = await fetch(`${baseUrl}/api/v1/snippets/${id}`, {
66 headers,
67 });
68
69 if (!response.ok) {
70 const error = await response.text();
71 throw new Error(error || "Failed to get snippet");
72 }
73
74 return response.json();
75 },
76 });

What it pulls in

npm packages

  • ai
  • zod

Files it writes

  • registry/tools/pastecn.ts

Facts

Registry
pastecn
Type
registry:file
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
today

Go to the source

Docs on pastecn pastecn.com rbadillap/pastecn on GitHub Raw registry item This item as JSON
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex