MCPcopy Create free account
hub / github.com/developersdigest/llm-answer-engine / goShopping

Function goShopping

app/function-calling.tsx:50–74  ·  view source on GitHub ↗
(message: string)

Source from the content-addressed store, hash-verified

48 }
49}
50export async function goShopping(message: string) {
51 const url = 'https://google.serper.dev/shopping';
52 const requestOptions: RequestInit = {
53 method: 'POST',
54 headers: {
55 'X-API-KEY': process.env.SERPER_API as string,
56 'Content-Type': 'application/json'
57 },
58 body: JSON.stringify({ "q": message })
59 };
60 try {
61 const response = await fetch(url, requestOptions);
62 if (!response.ok) {
63 console.error(`Failed to fetch ${url}. Status: ${response.status}`);
64 }
65 const responseData = await response.json();
66 const shoppingData = {
67 type: 'shopping',
68 shopping: responseData.shopping
69 };
70 return JSON.stringify(shoppingData);
71 } catch (error) {
72 console.error('Error fetching shopping data:', error);
73 }
74}
75export async function getTickers(ticker: string) {
76 return JSON.stringify({ type: 'ticker', data: ticker });
77}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected