Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/lib/mcp/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ describe("captureMcpFeedback", () => {
describe("instrumentMcpAnalytics (SDK integration)", () => {
const ORG = "org_integration";

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

const missingCapabilityTool = (
await enabled.client.listTools()
).tools.find(({ name }) => name === "get_more_tools");
expect(missingCapabilityTool?.description).toContain(
"only after checking the available tools",
);
expect(missingCapabilityTool?.description).toContain(
"transient failure or capacity limit",
);
expect(missingCapabilityTool?.description).toContain(
"client-side permission restriction",
);

const result = await disabled.client.callTool({
name: KERNEL_FEEDBACK_TOOL_NAME,
arguments: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mcp/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const MISSING_CAPABILITY_CONTEXT_DESCRIPTION =
function registerMissingCapabilityTool(server: McpServer) {
server.tool(
MISSING_CAPABILITY_TOOL_NAME,
"Check for additional tools whenever your task might benefit from specialized capabilities - even if existing tools could work as a fallback.",
"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.",
{
context: z.string().describe(MISSING_CAPABILITY_CONTEXT_DESCRIPTION),
},
Expand Down
Loading