src / mcp / toolResults.ts
src / mcp / toolResults.ts
import { getHealthyServerBaseUrl } from "../core-bundle.mjs";
import { buildGenericResultContent, buildMultiResultText, buildSingleResultText, buildOriginalLinks, buildUnslothResultContent, type MaterializedResult, type ResultTier } from "./core-bundle.mjs";
export { buildMultiResultText, buildSingleResultText };
/**
* Generic-preset result content: the http(s)/file:// original-file link(s) are built by
* made-for-bionic-core's shared buildOriginalLinks() (scratchpadFolder-scoped URL, never a
* synthetic chat id) — only getHealthyServerBaseUrl() (draw-things-chat-core-only) stays here.
* Used only for detect_object/annotate_image — analyse_image never materializes a file.
*
* Generic preset ONLY — unsloth has its own, independent buildUnslothToolResult() below.
*/
export async function buildGenericToolResult(
tool: "detect_object" | "annotate_image",
tier: ResultTier,
scratchpadPath: string,
scratchpadFolder: string | undefined,
results: MaterializedResult[],
summaryText: string | undefined
): Promise<{ content: unknown[] }> {
const httpBase = await getHealthyServerBaseUrl();
return buildGenericResultContent(
tool,
tier,
scratchpadPath,
results,
summaryText,
(result) => buildOriginalLinks(httpBase, scratchpadFolder, result.filename, result.absolutePath, result.notation)
);
}
/**
* Unsloth-preset result content — made-for-bionic-core's own, independent builder (see
* unsloth.ts's buildUnslothResultContent()), not a mode of buildGenericResultContent().
*/
export async function buildUnslothToolResult(
tool: "detect_object" | "annotate_image",
tier: ResultTier,
scratchpadPath: string,
scratchpadFolder: string | undefined,
results: MaterializedResult[],
summaryText: string | undefined
): Promise<{ content: unknown[] }> {
const httpBase = await getHealthyServerBaseUrl();
return buildUnslothResultContent(
tool,
tier,
scratchpadPath,
results,
summaryText,
(result) => buildOriginalLinks(httpBase, scratchpadFolder, result.filename, result.absolutePath, result.notation)
);
}
import { getHealthyServerBaseUrl } from "../core-bundle.mjs";
import { buildGenericResultContent, buildMultiResultText, buildSingleResultText, buildOriginalLinks, buildUnslothResultContent, type MaterializedResult, type ResultTier } from "./core-bundle.mjs";
export { buildMultiResultText, buildSingleResultText };
/**
* Generic-preset result content: the http(s)/file:// original-file link(s) are built by
* made-for-bionic-core's shared buildOriginalLinks() (scratchpadFolder-scoped URL, never a
* synthetic chat id) — only getHealthyServerBaseUrl() (draw-things-chat-core-only) stays here.
* Used only for detect_object/annotate_image — analyse_image never materializes a file.
*
* Generic preset ONLY — unsloth has its own, independent buildUnslothToolResult() below.
*/
export async function buildGenericToolResult(
tool: "detect_object" | "annotate_image",
tier: ResultTier,
scratchpadPath: string,
scratchpadFolder: string | undefined,
results: MaterializedResult[],
summaryText: string | undefined
): Promise<{ content: unknown[] }> {
const httpBase = await getHealthyServerBaseUrl();
return buildGenericResultContent(
tool,
tier,
scratchpadPath,
results,
summaryText,
(result) => buildOriginalLinks(httpBase, scratchpadFolder, result.filename, result.absolutePath, result.notation)
);
}
/**
* Unsloth-preset result content — made-for-bionic-core's own, independent builder (see
* unsloth.ts's buildUnslothResultContent()), not a mode of buildGenericResultContent().
*/
export async function buildUnslothToolResult(
tool: "detect_object" | "annotate_image",
tier: ResultTier,
scratchpadPath: string,
scratchpadFolder: string | undefined,
results: MaterializedResult[],
summaryText: string | undefined
): Promise<{ content: unknown[] }> {
const httpBase = await getHealthyServerBaseUrl();
return buildUnslothResultContent(
tool,
tier,
scratchpadPath,
results,
summaryText,
(result) => buildOriginalLinks(httpBase, scratchpadFolder, result.filename, result.absolutePath, result.notation)
);
}