Skip to content
Merged
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
10 changes: 9 additions & 1 deletion open-sse/handlers/responseTranslator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,15 @@ export function translateNonStreamingResponse(
if (toolCalls.length > 0) {
message.tool_calls = toolCalls;
}
if (message.content === undefined) {
if (
(!message.content ||
(typeof message.content === "string" && message.content.trim().length === 0)) &&
toolCalls.length === 0 &&
replayableReasoningContent &&
replayableReasoningContent.trim().length > 0
) {
message.content = replayableReasoningContent;
} else if (message.content === undefined) {
message.content = "";
}

Expand Down
6 changes: 3 additions & 3 deletions open-sse/mcp-server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import {
clampMcpAccessibilityConfig,
type McpAccessibilityConfig,
} from "../services/compression/engines/mcpAccessibility/constants.ts";
import { getDbInstance } from "../../src/lib/db/core.ts";
import { getDbInstance, ensureDbInitialized } from "../../src/lib/db/core.ts";
import { normalizeQuotaResponse } from "../../src/shared/contracts/quota.ts";
import { resolveOmniRouteBaseUrl } from "../../src/shared/utils/resolveOmniRouteBaseUrl.ts";
import { sanitizeErrorMessage } from "../utils/error.ts";
Expand Down Expand Up @@ -1527,10 +1527,10 @@ export function createMcpServer(options?: CreateMcpServerOptions): McpServer {
* Called when `omniroute --mcp` is used.
*/
export async function startMcpStdio(): Promise<void> {
await ensureDbInitialized();
// Stdout is reserved for JSON-RPC — bin/mcpStdioConsoleGuard.mjs is preloaded via
// `node --import` (see bin/mcp-server.mjs) so console.log/warn already redirect to
// stderr before this module's own imports evaluate (DB init happens as a side effect of
// createMcpServer()'s tool registration, earlier than any code placed here could catch).
// stderr before this module's own imports evaluate.
const server = createMcpServer();
const transport = new StdioServerTransport();
const version = process.env.npm_package_version || "1.8.1";
Expand Down
Loading