Skip to main content

Documentation Index

Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

veryfront/resource

Declare and register resources exposable over MCP.

Import

import { resource, resourceRegistry } from "veryfront/resource";

Examples

import { resource } from "veryfront/resource";
import { z } from "zod";

const docsBySection: Record<string, string> = {
  agents: "Agents accept messages, tools, context, and runtime options.",
  tools: "Tools expose schema-backed callable capabilities.",
};

const docs = resource({
  pattern: "docs/:section",
  description: "API documentation",
  paramsSchema: z.object({ section: z.string() }),
  load: ({ section }) => {
    return { content: docsBySection[section] ?? "Section not found." };
  },
});

const result = await docs.load({ section: "agents" });

API

resource(config)

Create a typed resource definition.
PropertyTypeDescriptionSource
pattern?stringURI template pattern for parameterized resourcessource
descriptionstringResource descriptionsource
title?stringsource
paramsSchemaSchema<TParams>Zod schema for URI parameterssource
load(params: TParams) => Promise<TData> | TDataFunction returning resource contentsource
subscribe?(params: TParams) => AsyncIterable<TData>Async iterable for real-time resource updatessource
mcp?McpConfigMCP server configurationsource
Returns: Resource<TParams, TData>

Exports

Functions

NameDescriptionSource
resourceCreate a typed resource definition.source

Types

NameDescriptionSource
ResourcePublic API contract for resource.source
ResourceConfigConfiguration used by resource.source

Constants

NameDescriptionSource
resourceRegistryShared resource registry value.source
Reference modules: User guides: Architecture: