memory / tools /curateTool.js
gcharanteja
feat: add curation and vector services, enhance README with local development and configuration details
cf2a24d
Raw
History Blame Contribute Delete
1.37 kB
import { curateText } from "../services/curation.js";
const curateKnowledgeTool = {
name: "curate_knowledge",
description:
"Extract and curate knowledge from text. Saves structured JSON as markdown file in context-tree.",
inputSchema: {
type: "object",
properties: {
text: {
type: "string",
description: "The text content to curate and extract knowledge from.",
},
},
required: ["text"],
additionalProperties: false,
},
};
export const curateTools = [curateKnowledgeTool];
export async function handleCurateTool(name, args, config) {
if (name === "curate_knowledge") {
try {
if (!args.text || typeof args.text !== "string") {
return {
content: [
{
type: "text",
text: "Error: 'text' field is required and must be a string",
},
],
isError: true,
};
}
const result = await curateText(args.text, config);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
} catch (err) {
return {
content: [
{
type: "text",
text: `Curation error: ${err.message}`,
},
],
isError: true,
};
}
}
return null;
}