MCPcopy
hub / github.com/openai/openai-assistants-quickstart / functionCallHandler

Function functionCallHandler

app/examples/all/page.tsx:13–19  ·  view source on GitHub ↗
(call)

Source from the content-addressed store, hash-verified

11 const [weatherData, setWeatherData] = useState({});
12
13 const functionCallHandler = async (call) => {
14 if (call?.function?.name !== "get_weather") return;
15 const args = JSON.parse(call.function.arguments);
16 const data = getWeather(args.location);
17 setWeatherData(data);
18 return JSON.stringify(data);
19 };
20
21 // return (
22 // <main className={styles.main}>

Callers 1

handleRequiresActionFunction · 0.50

Calls 1

getWeatherFunction · 0.90

Tested by

no test coverage detected