Skip to content

Commit cb33042

Browse files
authored
Merge pull request #174 from kernel/hypeship/reduce-mcp-gap-noise
Reduce noisy MCP missing-capability reports
2 parents 5ceeed4 + 933bc1b commit cb33042

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/lib/mcp/analytics.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ describe("captureMcpFeedback", () => {
615615
describe("instrumentMcpAnalytics (SDK integration)", () => {
616616
const ORG = "org_integration";
617617

618-
test("keeps the feedback tool schema stable when analytics is disabled", async () => {
618+
test("keeps analytics tool contracts stable", async () => {
619619
const disabled = await connectTestMcp(
620620
(server) => instrumentMcpAnalytics(server, null),
621621
{},
@@ -639,6 +639,19 @@ describe("instrumentMcpAnalytics (SDK integration)", () => {
639639
expect(disabledTool?.inputSchema).toEqual(enabledTool?.inputSchema);
640640
expect(disabledTool?.inputSchema.required).toContain("context");
641641

642+
const missingCapabilityTool = (
643+
await enabled.client.listTools()
644+
).tools.find(({ name }) => name === "get_more_tools");
645+
expect(missingCapabilityTool?.description).toContain(
646+
"only after checking the available tools",
647+
);
648+
expect(missingCapabilityTool?.description).toContain(
649+
"transient failure or capacity limit",
650+
);
651+
expect(missingCapabilityTool?.description).toContain(
652+
"client-side permission restriction",
653+
);
654+
642655
const result = await disabled.client.callTool({
643656
name: KERNEL_FEEDBACK_TOOL_NAME,
644657
arguments: {

src/lib/mcp/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ const MISSING_CAPABILITY_CONTEXT_DESCRIPTION =
311311
function registerMissingCapabilityTool(server: McpServer) {
312312
server.tool(
313313
MISSING_CAPABILITY_TOOL_NAME,
314-
"Check for additional tools whenever your task might benefit from specialized capabilities - even if existing tools could work as a fallback.",
314+
"Report a genuine server capability gap only after checking the available tools and confirming none can complete the task. Do not call this for an existing fallback, a transient failure or capacity limit, or a client-side permission restriction; use the available tool or submit_feedback instead.",
315315
{
316316
context: z.string().describe(MISSING_CAPABILITY_CONTEXT_DESCRIPTION),
317317
},

0 commit comments

Comments
 (0)