Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$2?q=fetch&page=45&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 13568 results for "fetch"(4049ms)

crm_OBUO_FARMSClientOrderForm.tsx7 matches

@eddie_walkโ€ขUpdated 3 days ago
29 const feedTypes = ['Fish Feed', 'Poultry Feed'] as const;
30
31 // Fetch products on component mount
32 useEffect(() => {
33 fetchProducts();
34 }, []);
35
39 }, [formData.productCategory, formData.fishType, formData.productForm, formData.poultryType, formData.eggType, formData.feedType]);
40
41 const fetchProducts = async () => {
42 try {
43 const response = await fetch('/api/products');
44 const result: ApiResponse<Product[]> = await response.json();
45 if (result.success && result.data) {
47 }
48 } catch (error) {
49 console.error('Failed to fetch products:', error);
50 }
51 };
110
111 try {
112 const response = await fetch('/api/orders', {
113 method: 'POST',
114 headers: {
137
138 // Refresh products to get updated stock
139 await fetchProducts();
140
141 // Scroll to top to show success message

mcp-servermain.ts7 matches

@AIWBโ€ขUpdated 3 days ago
1import { Hono, Context } from 'npm:hono';
2import { SSETransport } from 'npm:hono-mcp-server-sse-transport';
3import { toFetchResponse, toReqRes } from "npm:fetch-to-node";
4import { z } from "npm:zod";
5import lunr from "https://cdn.skypack.dev/lunr";
197
198 try {
199 console.log("Fetching site contents...");
200 const [searchData, proverbs] = await Promise.all([
201 fetch("https://www.joshbeckman.org/assets/js/SearchData.json").then((res) => res.json()),
202 fetch("https://www.joshbeckman.org/assets/js/proverbs.json").then((res) => res.json())
203 ]);
204 const db: Array<Post> = Object.values(searchData).filter(postFilter).map((post) => {
215 const index = buildIndex(searchData);
216 const tagsIndex = buildTagsIndex(tags);
217 console.log("Successfully fetched site contents");
218
219 console.log("Registering tools...");
403 });
404
405 return toFetchResponse(res);
406 } catch (e) {
407 console.error(e);
454 * This will be exposed as a Val.town HTTP endpoint
455 */
456export default app.fetch;
457

ChatStreamingChat.tsx7 matches

@AIWBโ€ขUpdated 3 days ago
5import { AnthropicStreamEvent, MCPPrompt } from "../../shared/types.ts";
6import useAnthropicStream from "../hooks/useAnthropicStream.tsx";
7import { fetchMCPPromptsWithCache } from "../utils/mcpPrompts.ts";
8import { AppConfig, Message } from "./App.tsx";
9import CommandPalette from "./CommandPalette.tsx";
106 }, [input]);
107
108 /* fetch MCP prompts when config changes */
109 useEffect(() => {
110 const fetchPrompts = async () => {
111 try {
112 const result = await fetchMCPPromptsWithCache(config.mcpServers);
113
114 if (result.success) {
116 setPrompts(result.prompts);
117 } else {
118 console.warn("Failed to fetch MCP prompts:", result.error);
119 // Keep existing prompts on error
120 }
121 } catch (error) {
122 console.warn("Failed to fetch MCP prompts:", error);
123 // Keep existing prompts on error
124 }
126
127 if (config.mcpServers.some(s => s.enabled && s.url)) {
128 fetchPrompts();
129 } else {
130 // If no servers are enabled, just show the built-in test prompt

ChatREADME.md3 matches

@AIWBโ€ขUpdated 3 days ago
24- **Structured display of MCP tool calls and results** to prevent truncation
25- **Frontend MCP server testing** - test button for each MCP server with visual status indicators (โœ…/โŒ)
26- **Frontend MCP prompt fetching** - prompts are fetched directly from MCP servers with caching support
27
28## Streaming Implementation
54โ”‚ โ”œโ”€โ”€ utils/
55โ”‚ โ”‚ โ”œโ”€โ”€ mcpTesting.ts # Frontend MCP server testing
56โ”‚ โ”‚ โ””โ”€โ”€ mcpPrompts.ts # Frontend MCP prompt fetching
57โ”‚ โ””โ”€โ”€ style.css # Custom styles with streaming animations
58โ”œโ”€โ”€ shared/
75- `GET /shared/*` - Shared utility files
76
77**Note**: MCP server testing and prompt fetching are now handled directly on the frontend for improved performance and reduced server load.
78
79## Usage

ChatmcpTesting.ts4 matches

@AIWBโ€ขUpdated 3 days ago
64
65 try {
66 const response = await fetch(server.url, {
67 method: "POST",
68 headers,
97 };
98 }
99 } catch (fetchError: any) {
100 clearTimeout(timeoutId);
101
102 if (fetchError.name === "AbortError") {
103 return {
104 success: false,
107 }
108
109 throw fetchError;
110 }
111 } catch (error: any) {

ChatmcpPrompts.ts20 matches

@AIWBโ€ขUpdated 3 days ago
2 * Frontend MCP Prompts Utility
3 *
4 * Handles fetching prompts from MCP servers directly from the frontend
5 * without requiring backend proxy endpoints.
6 */
23
24/**
25 * Fetch prompts from a single MCP server
26 * @param server - MCP server configuration
27 * @returns Promise<MCPPrompt[]>
28 */
29async function fetchPromptsFromServer(server: MCPServerConfig): Promise<MCPPrompt[]> {
30 if (!server.enabled || !server.url) {
31 return [];
47 try {
48 // First, initialize the connection
49 const initResponse = await fetch(server.url, {
50 method: "POST",
51 headers,
71 }
72
73 // Then fetch prompts
74 const promptsResponse = await fetch(server.url, {
75 method: "POST",
76 headers,
100 }
101 }
102 } catch (fetchError: any) {
103 clearTimeout(timeoutId);
104
105 if (fetchError.name === "AbortError") {
106 console.warn(`Timeout fetching prompts from ${server.name}`);
107 } else {
108 throw fetchError;
109 }
110 }
112 return [];
113 } catch (error) {
114 console.warn(`Failed to fetch prompts from ${server.name}:`, error);
115 return [];
116 }
118
119/**
120 * Fetch prompts from all enabled MCP servers
121 * @param servers - Array of MCP server configurations
122 * @returns Promise<MCPPromptsResult>
123 */
124export async function fetchMCPPrompts(servers: MCPServerConfig[]): Promise<MCPPromptsResult> {
125 try {
126 if (!servers || !Array.isArray(servers)) {
141 }
142
143 // Fetch prompts from all enabled servers concurrently
144 const promptPromises = enabledServers.map(server => fetchPromptsFromServer(server));
145 const promptArrays = await Promise.all(promptPromises);
146
175
176/**
177 * Fetch prompts with caching support
178 * @param servers - Array of MCP server configurations
179 * @param cacheKey - Optional cache key for localStorage
181 * @returns Promise<MCPPromptsResult>
182 */
183export async function fetchMCPPromptsWithCache(
184 servers: MCPServerConfig[],
185 cacheKey: string = "mcp_prompts_cache",
202 }
203
204 // Fetch fresh data
205 const result = await fetchMCPPrompts(servers);
206
207 // Cache successful results
223 try {
224 const { data } = JSON.parse(cached);
225 console.warn("Using stale cached prompts due to fetch error:", error);
226 return {
227 success: true,

Chatindex.ts1 match

@AIWBโ€ขUpdated 3 days ago
19});
20
21export default app.fetch;

projectTreemain.ts1 match

@nbbaierโ€ขUpdated 3 days ago
22);
23
24export default app.fetch;
25

test-yt-transcriptmain.tsx1 match

@ryiโ€ขUpdated 3 days ago
3 let videoId = "https://www.youtube.com/watch?v=5orZtBqftE8";
4 console.log("starting...");
5 let x = YoutubeTranscript.fetchTranscript(videoId);
6 console.log(x);
7};

crm_OBUO_FARMSproducts.ts10 matches

@eddie_walkโ€ขUpdated 3 days ago
20 });
21 } catch (error) {
22 console.error('Error fetching products:', error);
23 return c.json<ApiResponse<null>>({
24 success: false,
25 error: "Failed to fetch products"
26 }, 500);
27 }
37 });
38 } catch (error) {
39 console.error('Error fetching low stock products:', error);
40 return c.json<ApiResponse<null>>({
41 success: false,
42 error: "Failed to fetch low stock products"
43 }, 500);
44 }
69 });
70 } catch (error) {
71 console.error('Error fetching product:', error);
72 return c.json<ApiResponse<null>>({
73 success: false,
74 error: "Failed to fetch product"
75 }, 500);
76 }
259 });
260 } catch (error) {
261 console.error('Error fetching stock movements:', error);
262 return c.json<ApiResponse<null>>({
263 success: false,
264 error: "Failed to fetch stock movements"
265 }, 500);
266 }
278 });
279 } catch (error) {
280 console.error('Error fetching all stock movements:', error);
281 return c.json<ApiResponse<null>>({
282 success: false,
283 error: "Failed to fetch stock movements"
284 }, 500);
285 }

GithubPRFetcher

@andybakโ€ขUpdated 2 days ago

proxiedfetch1 file match

@jaydenโ€ขUpdated 3 days ago