@neat.is/mcp 0.9.2-dev.20260821 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -662,6 +662,36 @@ async function relate(client2, input) {
|
|
|
662
662
|
return formatErrorResponse(`Error talking to neat-core: ${err.message}`);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
+
async function ask(client2, input) {
|
|
666
|
+
const question = input.question.trim();
|
|
667
|
+
if (!question) return formatEmptyResponse("ask: the question was empty.");
|
|
668
|
+
return withMissingNodeFallback(async () => {
|
|
669
|
+
const result = await client2.get(
|
|
670
|
+
projectPath(input.project, `/graph/ask?q=${encodeURIComponent(question)}`)
|
|
671
|
+
);
|
|
672
|
+
const blockLines = [];
|
|
673
|
+
if (result.matched.length > 0) {
|
|
674
|
+
blockLines.push(
|
|
675
|
+
`Matched (${result.intent}): ` + result.matched.map((m) => `${m.nodeId} [${m.via} ${m.score.toFixed(2)}]`).join(", ")
|
|
676
|
+
);
|
|
677
|
+
} else if (result.scope === "global") {
|
|
678
|
+
blockLines.push(`Graph-wide answer (${result.intent}) \u2014 no entity named.`);
|
|
679
|
+
}
|
|
680
|
+
for (const section of result.sections) {
|
|
681
|
+
blockLines.push("", `${section.heading}:`);
|
|
682
|
+
for (const fact of section.facts) {
|
|
683
|
+
const tag = fact.provenance ? ` [${fact.provenance}${fact.confidence !== void 0 ? ` ${fact.confidence.toFixed(2)}` : ""}]` : fact.confidence !== void 0 ? ` [confidence ${fact.confidence.toFixed(2)}]` : "";
|
|
684
|
+
blockLines.push(` \u2022 ${fact.text}${tag}`);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return formatToolResponse({
|
|
688
|
+
summary: result.answer,
|
|
689
|
+
block: blockLines.join("\n").trim(),
|
|
690
|
+
...result.confidence !== void 0 ? { confidence: result.confidence } : {},
|
|
691
|
+
...result.provenance.length > 0 ? { provenance: result.provenance } : {}
|
|
692
|
+
});
|
|
693
|
+
}, `ask: nothing in "${question}" resolved to a node in the graph.`);
|
|
694
|
+
}
|
|
665
695
|
async function getIncidentHistory(client2, input) {
|
|
666
696
|
return withMissingNodeFallback(async () => {
|
|
667
697
|
const body = await client2.get(
|
|
@@ -1148,6 +1178,15 @@ var server = new import_mcp2.McpServer(
|
|
|
1148
1178
|
{ instructions: serverInstructions }
|
|
1149
1179
|
);
|
|
1150
1180
|
var registerTool = (name, description, paramsSchema, cb) => server.tool(name, description, paramsSchema, cb);
|
|
1181
|
+
registerTool(
|
|
1182
|
+
"ask",
|
|
1183
|
+
"Ask the graph a question in plain language \u2014 the front door to NEAT. Reach for this FIRST, before Read/Grep/Bash, for any question about this system's behaviour, dependencies, failures, root cause, or blast radius. You do NOT need to know which tool or the exact node id: `ask` resolves the entities in your question to graph nodes and routes it to the right traversal (root cause, dependencies, observed runtime calls, incidents, divergences, blast radius), returning one compact answer with every fact provenance-tagged (EXTRACTED/OBSERVED/INFERRED/STALE) and confidence-scored. Use the structured tools (get_root_cause, get_dependencies, \u2026) when you already have a node id and want just that one traversal.",
|
|
1184
|
+
{
|
|
1185
|
+
question: import_zod.z.string().describe('A natural-language question, e.g. "why is checkout failing?" or "what breaks if I change the orders table?"'),
|
|
1186
|
+
project: projectField
|
|
1187
|
+
},
|
|
1188
|
+
async (input) => ask(client, { ...input, project: projectFor(input) })
|
|
1189
|
+
);
|
|
1151
1190
|
registerTool(
|
|
1152
1191
|
"get_root_cause",
|
|
1153
1192
|
"Trace a failing node up its dependency graph to find the underlying cause. Use this when something is breaking and you want to know which upstream component is the actual culprit.",
|