5import {getErrorMessage} from "../lib/errorUtils.ts"
6
7export function registerUserTools(server: McpServer, config: Config) {
8 // Get user information by username
9 server.tool(
5import {getCliAvailability, runVtCommand} from "../lib/vtCli.ts"
6
7export function registerProjectTools(server: McpServer, config: Config) {
8 // List all projects
9 server.tool(
1This directory has crons that extract data from Notion and save that data to blob storage in val.town. Blob storage functions like a cache.
2
3# demoCache.ts
1The files in this directory export functions that get data from and save data to Notion. Most of these functions are used by /tasks.
2
3Every controller in this directory includes the Notion client:
20| Aspect | **Controller** | **Util** |
21| ----------------- | --------------------------------------------------- | --------------------------------------------------- |
22| **Purpose** | Orchestrates business logic and workflows | Provides small, stateless helper functions |
23| **Scope** | High-level, often involves services or side effects | Low-level, narrow in focus (e.g., string, date ops) |
24| **State** | Works with application or user-specific data | Stateless – input in, output out |
7### Task endpoints use /controllers to get and save data
8
9In order to keep the API easy to look and work with, the routes in /tasks handle routing but do not get data from or save data to Notion. The functions that connect to Notion live in the /controllers directory, and are _called_ from the endpoints in /tasks.
10
11### Naming convention for routes and controllers
25 Note that the export in the controller follows the same convention; it's also called `setDemoURL`.
26
271. Once the controller is imported, pass data to the exported function so that it can do its thing:
28
29 ```
31 ```
32
33 Note the function call is the exported function in the import object at the top of the route; i.e., `{ setDemoURL }`. The `setDemoURL.ts` controller exports it like this:
34
35 ```
36 // /controllers/setDemoURL.ts
37 export async function setDemoURL(data: any) {
38 try {
39 ...
4import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
5
6export default function StylesViewer() {
7 const [mediums, setMediums] = useState([]);
8 const [loading, setLoading] = useState(true);
4import StylesViewer from "./StylesViewer.tsx";
5
6export function App() {
7 return (
8 <div>
4import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
5
6export default function ColoursViewer() {
7 const [palettes, setPalettes] = useState([]);
8 const [loading, setLoading] = useState(true);
1export async function ReceiveSMS(req: Request): Promise<Response> {
2 try {
3 const bodyText = await req.text();
1export async function receiveSMS(req: Request) {
2 // Parse incoming form data
3 const form = await req.formData();
Simple functional CSS library for Val Town
A helper function to build a file's email
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.