MCPcopy Create free account
hub / github.com/KeyID-AI/agent-kit / apiFetch

Function apiFetch

src/index.js:79–86  ·  view source on GitHub ↗
(path, options = {})

Source from the content-addressed store, hash-verified

77}
78
79async function apiFetch(path, options = {}) {
80 const url = BASE_URL.replace(/\/$/, '') + path;
81 const headers = { 'Content-Type': 'application/json', ...options.headers };
82 const res = await fetch(url, { ...options, headers });
83 const data = await res.json();
84 if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
85 return data;
86}
87
88async function ensureAuth() {
89 if (token && Date.now() < tokenExpiresAt - 60_000) return;

Callers 2

ensureAuthFunction · 0.85
handleToolFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected