@debugg-ai/debugg-ai-mcp 3.1.0 → 3.2.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to the DebuggAI MCP project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.2.0]
9
+
10
+ ### Added — Structured tool output (`structuredContent`)
11
+
12
+ Every successful tool result now carries [`structuredContent`](https://modelcontextprotocol.io/specification/2025-06-18/server/tools)
13
+ — the parsed JSON payload — so clients can consume structured data directly
14
+ instead of re-parsing the text blob. The text block is kept for back-compat.
15
+
16
+ Promoted centrally in the CallTool path (`withStructuredContent` in
17
+ `utils/structuredContent.ts`) rather than touching every handler. No-op for
18
+ errors, non-object payloads, or multi-text results.
19
+
20
+ `outputSchema` is intentionally not declared: the action tools return
21
+ polymorphic shapes per action, a faithful schema would need top-level `oneOf`
22
+ (which the Anthropic API rejects), and a permissive schema adds no value.
23
+ `structuredContent` without a declared schema is spec-valid and is the win.
24
+
8
25
  ## [3.1.0]
9
26
 
10
27
  ### Added — Tool annotations (behavioral hints for clients)
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
21
21
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
22
22
  import { config } from "./config/index.js";
23
23
  import { initTools, getTools, getTool } from "./tools/index.js";
24
- import { Logger, validateInput, createErrorResponse, toMCPError, handleConfigurationError, Telemetry, TelemetryEvents, } from "./utils/index.js";
24
+ import { Logger, validateInput, createErrorResponse, toMCPError, handleConfigurationError, Telemetry, TelemetryEvents, withStructuredContent, } from "./utils/index.js";
25
25
  import { MCPErrorCode, MCPError, } from "./types/index.js";
26
26
  // Logger and server are initialized lazily in main() to avoid triggering
27
27
  // config loading at module load time. If config validation fails (bad env vars),
@@ -116,7 +116,8 @@ function registerHandlers() {
116
116
  const toolDuration = Date.now() - toolStart;
117
117
  requestLogger.info(`Tool execution completed: ${name}`);
118
118
  Telemetry.capture(TelemetryEvents.TOOL_EXECUTED, { toolName: name, durationMs: toolDuration, success: true });
119
- return result;
119
+ // Promote the JSON text payload to structuredContent (back-compat: text stays).
120
+ return withStructuredContent(result);
120
121
  }
121
122
  catch (error) {
122
123
  const mcpError = toMCPError(error, 'tool execution');
@@ -7,3 +7,4 @@ export * from './errors.js';
7
7
  export * from './projectAnalyzer.js';
8
8
  export * from './imageUtils.js';
9
9
  export * from './telemetry.js';
10
+ export * from './structuredContent.js';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Structured tool output (epic 3eb5l).
3
+ *
4
+ * MCP 2025-06-18 added `structuredContent` on tool results: a machine-readable
5
+ * JSON object that mirrors the human-readable text block. Clients that support
6
+ * it consume parsed data directly instead of re-parsing the text blob; the text
7
+ * block stays for back-compat.
8
+ *
9
+ * Every leaf handler already returns its payload as `JSON.stringify(payload)` in
10
+ * a single text item, so rather than touch ~20 handlers we promote it in ONE
11
+ * place — the CallTool path in index.ts wraps each result with this helper.
12
+ *
13
+ * We intentionally do NOT declare `outputSchema` on the tools: the action tools
14
+ * return polymorphic shapes per action, a faithful schema would need top-level
15
+ * `oneOf` (which the Anthropic API rejects, same as input schemas), and a
16
+ * permissive `type:object` schema adds no value. `structuredContent` without a
17
+ * declared schema is spec-valid and is the actual win.
18
+ */
19
+ /**
20
+ * Attach `structuredContent` to a successful tool result when its single text
21
+ * block is a JSON object. No-op for errors, multi-text results, non-object
22
+ * payloads, or results that already set structuredContent.
23
+ */
24
+ export function withStructuredContent(result) {
25
+ if (!result || result.isError || result.structuredContent)
26
+ return result;
27
+ const textItems = (result.content || []).filter((c) => c.type === 'text' && typeof c.text === 'string');
28
+ if (textItems.length !== 1)
29
+ return result;
30
+ let parsed;
31
+ try {
32
+ parsed = JSON.parse(textItems[0].text);
33
+ }
34
+ catch {
35
+ return result; // not JSON (shouldn't happen for our handlers) — leave as-is
36
+ }
37
+ // Spec requires structuredContent to be a JSON object (not array/primitive/null).
38
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
39
+ return result;
40
+ }
41
+ return { ...result, structuredContent: parsed };
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@debugg-ai/debugg-ai-mcp",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Zero-Config, Fully AI-Managed End-to-End Testing for all code gen platforms.",
5
5
  "type": "module",
6
6
  "bin": {