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

Function getSkillQuestions

packages/cli/src/utils/api.ts:139–164  ·  view source on GitHub ↗
(
  libraries: Array<{ id: string; name: string }>,
  motivation: string,
  accessToken?: string
)

Source from the content-addressed store, hash-verified

137}
138
139export async function getSkillQuestions(
140 libraries: Array<{ id: string; name: string }>,
141 motivation: string,
142 accessToken?: string
143): Promise<SkillQuestionsResponse> {
144 const headers: Record<string, string> = { "Content-Type": "application/json" };
145 if (accessToken) {
146 headers["Authorization"] = `Bearer ${accessToken}`;
147 }
148
149 const response = await fetch(`${baseUrl}/api/v2/skills/questions`, {
150 method: "POST",
151 headers,
152 body: JSON.stringify({ libraries, motivation }),
153 });
154
155 if (!response.ok) {
156 const errorData = await response.json().catch(() => ({}));
157 return {
158 questions: [],
159 error: (errorData as { message?: string }).message || `HTTP error ${response.status}`,
160 };
161 }
162
163 return (await response.json()) as SkillQuestionsResponse;
164}
165
166export async function generateSkillStructured(
167 input: StructuredGenerateInput,

Callers 1

generateCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected