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)
16build
17taskNotes
18valTownApi.json
19valtownAPIv2.json
20val-town-mcp-server
21.claude
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
39console.error(`CLI error when getting val, falling back to API: ${result.error}`);
40// Fall back to API on error
41} catch (error) {
42console.error("CLI error, falling back to API:", getErrorMessage(error));
43// Fall back to API on error
44}
45}
4647// API implementation (original code)
48try {
49const data = await callValTownApi(
50config,
51`/v2/alias/vals/${encodeURIComponent(username)}/${encodeURIComponent(valName)}`
75async ({query, limit, offset}) => {
76try {
77const data = await callValTownApi(
78config,
79`/v1/search/vals?query=${encodeURIComponent(query)}&limit=${limit}&offset=${offset}`
135}
136
137console.error(`CLI error when creating val, falling back to API: ${result.error}`);
138// Fall back to API on error
139} catch (error) {
140console.error("CLI error, falling back to API:", getErrorMessage(error));
141// Fall back to API on error
142}
143}
144145// API implementation (original code)
146try {
147const requestBody = {
151}
152153const data = await callValTownApi(
154config,
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
198console.log("Deletion via CLI requires workspace setup, using API instead");
199} catch (error) {
200console.error("CLI error, falling back to API:", getErrorMessage(error));
201// Fall back to API on error
202}
203}
204205// API implementation (original code)
206try {
207await callValTownApi(
208config,
209`/v2/vals/${valId}`,
262}
263
264console.error(`CLI error when listing vals, falling back to API: ${result.error}`);
265// Fall back to API on error
266} catch (error) {
267console.error("CLI error, falling back to API:", getErrorMessage(error));
268// Fall back to API on error
269}
270}
271272// API implementation (original code)
273try {
274const data = await callValTownApi(
275config,
276`/v2/me/vals?limit=${limit}&offset=${offset}`