MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / handleNLPParse

Method handleNLPParse

src/api/SystemController.ts:65–94  ·  view source on GitHub ↗
(req: HTTPRequestLike, res: HTTPResponseLike)

Source from the content-addressed store, hash-verified

63
64 @Post("/api/nlp/parse")
65 async handleNLPParse(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> {
66 try {
67 const body = await this.parseRequestBody(req);
68
69 if (!body.text || typeof body.text !== "string") {
70 this.sendResponse(
71 res,
72 400,
73 this.errorResponse("Text field is required and must be a string")
74 );
75 return;
76 }
77
78 // Parse the natural language input
79 const parsedData = this.nlParser.parseInput(body.text);
80
81 const taskData = buildTaskCreationDataFromParsed(this.plugin, parsedData);
82
83 this.sendResponse(
84 res,
85 200,
86 this.successResponse({
87 parsed: parsedData,
88 taskData: taskData,
89 })
90 );
91 } catch (error: unknown) {
92 this.sendResponse(res, 500, this.errorResponse(this.getErrorMessage(error)));
93 }
94 }
95
96 @Post("/api/nlp/create")
97 async handleNLPCreate(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> {

Calls 6

sendResponseMethod · 0.80
errorResponseMethod · 0.80
successResponseMethod · 0.80
parseInputMethod · 0.65
getErrorMessageMethod · 0.45

Tested by

no test coverage detected