MCPcopy
hub / github.com/upstash/context7 / generateSkillStructured

Function generateSkillStructured

packages/cli/src/utils/api.ts:166–184  ·  view source on GitHub ↗
(
  input: StructuredGenerateInput,
  onEvent?: (event: GenerateStreamEvent) => void,
  accessToken?: string
)

Source from the content-addressed store, hash-verified

164}
165
166export async function generateSkillStructured(
167 input: StructuredGenerateInput,
168 onEvent?: (event: GenerateStreamEvent) => void,
169 accessToken?: string
170): Promise<GenerateSkillResponse> {
171 const headers: Record<string, string> = { "Content-Type": "application/json" };
172 if (accessToken) {
173 headers["Authorization"] = `Bearer ${accessToken}`;
174 }
175
176 const response = await fetch(`${baseUrl}/api/v2/skills/generate`, {
177 method: "POST",
178 headers,
179 body: JSON.stringify(input),
180 });
181
182 const libraryName = input.libraries[0]?.name || "skill";
183 return handleGenerateResponse(response, libraryName, onEvent);
184}
185
186async function handleGenerateResponse(
187 response: Response,

Callers 1

generateCommandFunction · 0.85

Calls 1

handleGenerateResponseFunction · 0.85

Tested by

no test coverage detected