31 * Uses a cached instance if available
32 */
33export async function setupMcpServer(): Promise<McpServer> {
34 // Return cached instance if available
35 if (mcpServerInstance) {
78 * Registers a GET endpoint as an MCP Resource
79 */
80function registerResource(
81 server: McpServer,
82 operationId: string,
165 * Registers a POST, PUT, or DELETE endpoint as an MCP Tool
166 */
167function registerTool(
168 server: McpServer,
169 operationId: string,
270 * Converts an operation ID to a name for the MCP server
271 */
272function nameFromOperationId(operationId: string): string {
273 return operationId
274 // Replace {id} with 'by ID'
307 * }
308 */
309export function createParameterSchema(operation: OperationObject): {
310 description: string;
311 inputSchema: Record<string, z.ZodTypeAny>;
332}
333
334function createZodSchema(schema: SchemaObject): z.ZodTypeAny {
335 // if the type of this schema is an object then recursively create a zod schema for each property
336 let property: z.ZodTypeAny;
17 * Fetches the Livestorm API OpenAPI definition
18 */
19export async function fetchOpenApiSpec(): Promise<OpenApiSchema> {
20 try {
21 // Check if the OpenAPI spec is cached in Blob storage
79 * Extracts GET endpoints from the OpenAPI spec
80 */
81export function extractGetEndpoints(spec: OpenApiSchema) {
82 const getEndpoints: Record<
83 string,
101 * Extracts POST, PUT, DELETE endpoints from the OpenAPI spec
102 */
103export function extractMutationEndpoints(spec: OpenApiSchema) {
104 const mutationEndpoints: Record<
105 string,
150 * Proxies a request to the Livestorm API
151 */
152export async function proxyRequest(
153 path: string,
154 method: string,
1export default async function server(request: Request): Promise<Response> {
2 // Get the HTTP method
3 const method = request.method.toUpperCase();
1export default async function (e: Email) {
2
3}
12}
13
14export function ActionButtons({
15 state,
16 onStartWork,
2import { twMerge } from "https://esm.sh/tailwind-merge@3.0.1";
3
4export function cn(...inputs: ClassValue[]) {
5 return twMerge(clsx(inputs));
6}
3import type { ChatMessage, ApiResponse } from "../../shared/types.ts";
4
5export default function ChatRoom() {
6 const [messages, setMessages] = useState<ChatMessage[]>([]);
7 const [newMessage, setNewMessage] = useState('');
7}
8
9export default function JobForm({ onJobCreated }: JobFormProps) {
10 const [formData, setFormData] = useState({
11 title: '',
4import JobForm from "./JobForm.tsx";
5
6export default function JobBoard() {
7 const [jobs, setJobs] = useState<Job[]>([]);
8 const [loading, setLoading] = useState(true);
6type Tab = 'jobs' | 'chat';
7
8export default function App() {
9 const [activeTab, setActiveTab] = useState<Tab>('jobs');
10
A helper function to build a file's email
Simple functional CSS library for Val Town
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.