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/...?q=api&page=70&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 18954 results for "api"(2183ms)

myApi1 file match

@jacob_kettle•Updated 1 year ago

postHogAPICapture1 file match

@ianvph•Updated 1 year ago

myApi1 file match

@ollypolly•Updated 1 year ago

val-town-http-mcp-server.vtignore2 matches

@nbbaier•Updated 5 mins ago
16build
17taskNotes
18valTownApi.json
19valtownAPIv2.json
20val-town-mcp-server
21.claude

val-town-http-mcp-servervalsTools.ts27 matches

@nbbaier•Updated 5 mins ago
1import {McpServer} from "npm:@modelcontextprotocol/sdk/server/mcp.js"
2import {Config} from "../lib/types.ts"
3import {callValTownApi} from "../lib/api.ts"
4import {getErrorMessage} from "../lib/errorUtils.ts"
5import {getCliAvailability, runVtCommand, parseCliJsonOutput} from "../lib/vtCli.ts"
37 }
38
39 console.error(`CLI error when getting val, falling back to API: ${result.error}`);
40 // Fall back to API on error
41 } catch (error) {
42 console.error("CLI error, falling back to API:", getErrorMessage(error));
43 // Fall back to API on error
44 }
45 }
46
47 // API implementation (original code)
48 try {
49 const data = await callValTownApi(
50 config,
51 `/v2/alias/vals/${encodeURIComponent(username)}/${encodeURIComponent(valName)}`
75 async ({query, limit, offset}) => {
76 try {
77 const data = await callValTownApi(
78 config,
79 `/v1/search/vals?query=${encodeURIComponent(query)}&limit=${limit}&offset=${offset}`
135 }
136
137 console.error(`CLI error when creating val, falling back to API: ${result.error}`);
138 // Fall back to API on error
139 } catch (error) {
140 console.error("CLI error, falling back to API:", getErrorMessage(error));
141 // Fall back to API on error
142 }
143 }
144
145 // API implementation (original code)
146 try {
147 const requestBody = {
151 }
152
153 const data = await callValTownApi(
154 config,
155 `/v2/vals`,
192
193 // Use prepareValWorkspace first (would need to implement special workspace setup)
194 // For now, we'll use the API implementation instead of complex workspace management
195
196 // This could be implemented with temporary directory setup if needed,
197 // but for now we'll use the API for deletion as it's simpler
198 console.log("Deletion via CLI requires workspace setup, using API instead");
199 } catch (error) {
200 console.error("CLI error, falling back to API:", getErrorMessage(error));
201 // Fall back to API on error
202 }
203 }
204
205 // API implementation (original code)
206 try {
207 await callValTownApi(
208 config,
209 `/v2/vals/${valId}`,
262 }
263
264 console.error(`CLI error when listing vals, falling back to API: ${result.error}`);
265 // Fall back to API on error
266 } catch (error) {
267 console.error("CLI error, falling back to API:", getErrorMessage(error));
268 // Fall back to API on error
269 }
270 }
271
272 // API implementation (original code)
273 try {
274 const data = await callValTownApi(
275 config,
276 `/v2/me/vals?limit=${limit}&offset=${offset}`
apiry
snartapi