@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.js
CHANGED
|
@@ -667,6 +667,36 @@ async function relate(client2, input) {
|
|
|
667
667
|
return formatErrorResponse(`Error talking to neat-core: ${err.message}`);
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
+
async function ask(client2, input) {
|
|
671
|
+
const question = input.question.trim();
|
|
672
|
+
if (!question) return formatEmptyResponse("ask: the question was empty.");
|
|
673
|
+
return withMissingNodeFallback(async () => {
|
|
674
|
+
const result = await client2.get(
|
|
675
|
+
projectPath(input.project, `/graph/ask?q=${encodeURIComponent(question)}`)
|
|
676
|
+
);
|
|
677
|
+
const blockLines = [];
|
|
678
|
+
if (result.matched.length > 0) {
|
|
679
|
+
blockLines.push(
|
|
680
|
+
`Matched (${result.intent}): ` + result.matched.map((m) => `${m.nodeId} [${m.via} ${m.score.toFixed(2)}]`).join(", ")
|
|
681
|
+
);
|
|
682
|
+
} else if (result.scope === "global") {
|
|
683
|
+
blockLines.push(`Graph-wide answer (${result.intent}) \u2014 no entity named.`);
|
|
684
|
+
}
|
|
685
|
+
for (const section of result.sections) {
|
|
686
|
+
blockLines.push("", `${section.heading}:`);
|
|
687
|
+
for (const fact of section.facts) {
|
|
688
|
+
const tag = fact.provenance ? ` [${fact.provenance}${fact.confidence !== void 0 ? ` ${fact.confidence.toFixed(2)}` : ""}]` : fact.confidence !== void 0 ? ` [confidence ${fact.confidence.toFixed(2)}]` : "";
|
|
689
|
+
blockLines.push(` \u2022 ${fact.text}${tag}`);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return formatToolResponse({
|
|
693
|
+
summary: result.answer,
|
|
694
|
+
block: blockLines.join("\n").trim(),
|
|
695
|
+
...result.confidence !== void 0 ? { confidence: result.confidence } : {},
|
|
696
|
+
...result.provenance.length > 0 ? { provenance: result.provenance } : {}
|
|
697
|
+
});
|
|
698
|
+
}, `ask: nothing in "${question}" resolved to a node in the graph.`);
|
|
699
|
+
}
|
|
670
700
|
async function getIncidentHistory(client2, input) {
|
|
671
701
|
return withMissingNodeFallback(async () => {
|
|
672
702
|
const body = await client2.get(
|
|
@@ -1153,6 +1183,15 @@ var server = new McpServer(
|
|
|
1153
1183
|
{ instructions: serverInstructions }
|
|
1154
1184
|
);
|
|
1155
1185
|
var registerTool = (name, description, paramsSchema, cb) => server.tool(name, description, paramsSchema, cb);
|
|
1186
|
+
registerTool(
|
|
1187
|
+
"ask",
|
|
1188
|
+
"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.",
|
|
1189
|
+
{
|
|
1190
|
+
question: z.string().describe('A natural-language question, e.g. "why is checkout failing?" or "what breaks if I change the orders table?"'),
|
|
1191
|
+
project: projectField
|
|
1192
|
+
},
|
|
1193
|
+
async (input) => ask(client, { ...input, project: projectFor(input) })
|
|
1194
|
+
);
|
|
1156
1195
|
registerTool(
|
|
1157
1196
|
"get_root_cause",
|
|
1158
1197
|
"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.",
|