touchdesigner-mcp-server
Version:
MCP server for TouchDesigner
84 lines (83 loc) • 2.31 kB
TypeScript
/**
* Response Formatter Utilities
*
* Provides token-optimized formatting for MCP tool responses.
* Based on the design document: docs/context-optimization-design.md
*/
/**
* Detail level for response formatting
* - minimal: Only essential information (lowest tokens)
* - summary: Key information with counts and hints (balanced)
* - detailed: Full information (original behavior)
*/
export type DetailLevel = "minimal" | "summary" | "detailed";
/**
* Common formatting options
*/
import { type PresenterFormat } from "./presenter.js";
export interface FormatterOptions {
/**
* Backwards-compatible alias for detailLevel
* @deprecated Use detailLevel instead
*/
mode?: DetailLevel;
/**
* Level of detail in the response
* @default "summary"
*/
detailLevel?: DetailLevel;
/**
* Maximum number of items to include in lists
* @default undefined (no limit)
*/
limit?: number;
/**
* Include hints about omitted content
* @default true
*/
includeHints?: boolean;
/**
* Structured output format for detailed mode
* @default "yaml"
*/
responseFormat?: PresenterFormat;
}
/**
* Default formatter options
*/
export declare const DEFAULT_FORMATTER_OPTIONS: {
detailLevel: "summary";
includeHints: true;
limit: number | undefined;
responseFormat: PresenterFormat | undefined;
};
/**
* Merge user options with defaults
*/
export declare function mergeFormatterOptions(options?: FormatterOptions): {
detailLevel: DetailLevel;
limit: number | undefined;
includeHints: boolean;
responseFormat?: PresenterFormat;
};
interface FormatterMetadata {
template?: string;
context?: Record<string, unknown>;
structured?: unknown;
}
export declare function finalizeFormattedText(text: string, opts: {
responseFormat?: PresenterFormat;
detailLevel: DetailLevel;
}, metadata?: FormatterMetadata): string;
/**
* Format a hint message for omitted content
*/
export declare function formatOmissionHint(totalCount: number, shownCount: number, itemType: string): string;
/**
* Truncate array based on limit option
*/
export declare function limitArray<T>(items: T[], limit: number | undefined): {
items: T[];
truncated: boolean;
};
export {};