MCPcopy Create free account
hub / github.com/MemTensor/MemOS / handleSkillUpdate

Method handleSkillUpdate

packages/memos-core/src/viewer/server.ts:1406–1426  ·  view source on GitHub ↗
(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string)

Source from the content-addressed store, hash-verified

1404 }
1405
1406 private handleSkillUpdate(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string): void {
1407 const skillId = urlPath.replace("/api/skill/", "");
1408 this.readBody(req, (body) => {
1409 try {
1410 const data = JSON.parse(body);
1411 const skill = this.store.getSkill(skillId);
1412 if (!skill) { res.writeHead(404, { "Content-Type": "application/json" }); res.end(JSON.stringify({ error: "Skill not found" })); return; }
1413 this.store.updateSkill(skillId, {
1414 description: data.description ?? skill.description,
1415 version: skill.version,
1416 status: data.status ?? skill.status,
1417 installed: skill.installed,
1418 qualityScore: skill.qualityScore,
1419 });
1420 this.jsonResponse(res, { ok: true, skillId });
1421 } catch (err) {
1422 res.writeHead(400, { "Content-Type": "application/json" });
1423 res.end(JSON.stringify({ error: String(err) }));
1424 }
1425 });
1426 }
1427
1428 private async handleSkillDisable(res: http.ServerResponse, urlPath: string): Promise<void> {
1429 const skillId = urlPath.split("/")[3];

Callers 1

handleRequestMethod · 0.95

Calls 6

readBodyMethod · 0.95
jsonResponseMethod · 0.95
endMethod · 0.80
getSkillMethod · 0.65
updateSkillMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected