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/$%7BsvgDataUrl%7D?q=api&page=49&format=json

For typeahead suggestions, use the /typeahead endpoint:

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

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

Found 19573 results for "api"(6746ms)

sqliteExplorerApp1README.md1 match

@charmaineUpdated 2 days ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerApp1main.tsx2 matches

@charmaineUpdated 2 days ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

amaama.tsx1 match

@tmcwxxxxxUpdated 2 days ago
81 </time>
82 <open-heart
83 href={`https://api.oh.dddddddddzzzz.org/github.com/dddddddddzzzz/${question.id}`}
84 emoji="❤️"
85 >

securityknowledge.md10 matches

@cricks_unmixed4uUpdated 2 days ago
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
24
25- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176
177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225
226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248 });
249 ```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252 ```ts
285 - For files in the project, use `readFile` helpers
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`

security.cursorrules10 matches

@cricks_unmixed4uUpdated 2 days ago
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
24
25- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176
177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225
226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248 });
249 ```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252 ```ts
285 - For files in the project, use `readFile` helpers
286
2875. **API Design:**
288 - `fetch` handler is the entry point for HTTP vals
289 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`

mcp-starterREADME.md1 match

@charmaineUpdated 2 days ago
30## What is the adapter for?
31
32The MCP TypeScript SDK uses Node-specific APIs that don't play nicely with Deno
33or edge functions:
34

invest-trackercrypto_news_cron.tsx2 matches

@samxii777Updated 2 days ago
2import { blob } from "https://esm.town/v/std/blob";
3
4const KEY = Deno.env.get("NEWSDATA")!; // API key
5const KEEP = 20; // store up to 20
6const WINDOW_MIN = 1440; // last 24 h
9 /* 1 ─ build query (size 10, English) */
10 const q = encodeURIComponent("bitcoin OR btc OR ethereum OR eth OR solana OR sol");
11 const url = `https://newsdata.io/api/1/latest?apikey=${KEY}&q=${q}&language=en&size=10`;
12
13 /* 2 ─ fetch & peek */

ChatHTMLRenderer.tsx23 matches

@c15rUpdated 2 days ago
9}
10
11interface MCPContextAPI {
12 // Tool operations
13 listTools: () => Promise<any[]>;
37 * - Renders HTML in a secure iframe
38 * - Provides fullscreen enter/exit affordances
39 * - Exposes MCP context API to iframe content
40 * - Handles iframe communication via postMessage
41 */
47 console.log("[MCP/Browser Renderer] HTMLRenderer: Rendering HTML:", { mcpClients });
48
49 // Create MCP context API that will be exposed to iframe
50 const createMCPContext = useCallback((): MCPContextAPI => {
51 const findClientByName = (serverName: string) => {
52 console.log("[MCP/Browser Renderer] Finding client by name:", serverName, mcpClients);
177 const { type, id, method, args } = event.data;
178
179 if (type !== "mcp-api-call") {
180 return;
181 }
186
187 if (typeof methodFunc !== "function") {
188 throw new Error(`Unknown MCP API method: ${method}`);
189 }
190
192
193 iframe.contentWindow?.postMessage({
194 type: "mcp-api-response",
195 id,
196 success: true,
199 } catch (error) {
200 iframe.contentWindow?.postMessage({
201 type: "mcp-api-response",
202 id,
203 success: false,
222 </script>
223 <script>
224 // MCP Context API for iframe content
225 window.mcpContext = {
226 // Async wrapper for postMessage communication
227 async callAPI(method, ...args) {
228 return new Promise((resolve, reject) => {
229 const id = Math.random().toString(36).substr(2, 9);
230
231 const handleResponse = (event) => {
232 if (event.data.type === 'mcp-api-response' && event.data.id === id) {
233 window.removeEventListener('message', handleResponse);
234 if (event.data.success) {
243
244 window.parent.postMessage({
245 type: 'mcp-api-call',
246 id,
247 method,
252 setTimeout(() => {
253 window.removeEventListener('message', handleResponse);
254 reject(new Error('MCP API call timeout'));
255 }, 30000);
256 });
258
259 // Convenience methods
260 async listTools() { return this.callAPI('listTools'); },
261 async callTool(serverName, toolName, args) { return this.callAPI('callTool', serverName, toolName, args); },
262 async listPrompts() { return this.callAPI('listPrompts'); },
263 async getPrompt(serverName, promptName, args) { return this.callAPI('getPrompt', serverName, promptName, args); },
264 async listResources() { return this.callAPI('listResources'); },
265 async readResource(serverName, uri) { return this.callAPI('readResource', serverName, uri); },
266 log(level, message, data) { this.callAPI('log', level, message, data); },
267 requestFullscreen() { this.callAPI('requestFullscreen'); },
268 exitFullscreen() { this.callAPI('exitFullscreen'); },
269 async isFullscreen() { return this.callAPI('isFullscreen'); }
270 };
271
1import { getArticle, getAuthor } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
1import { getArticle } from "./_api.ts";
2import { createServer } from "./_server.ts";
3

researchAgent2 file matches

@thesephistUpdated 1 day ago
This is a lightweight wrapper around Perplexity's web search API

memoryApiExample2 file matches

@ingenierotitoUpdated 1 day ago
Kapil01
apiv1