Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
import type { BasicBuilder } from './BasicBuilder';
import { Writer } from './Writer';
export function assertNever(_arg: never, errorMessage: string): never {
throw new Error(errorMessage);
}
type StringifyOptions = {
indentLevel?: number;
newLine?: 'none' | 'leading' | 'trailing' | 'both';
};
export function stringify(
builder: BasicBuilder,
{ indentLevel = 0, newLine = 'none' }: StringifyOptions = {}
) {
const str = new Writer(indentLevel, undefined).write(builder).toString();
switch (newLine) {
case 'none':
return str;
case 'leading':
return '\n' + str;
case 'trailing':
return str + '\n';
case 'both':
return '\n' + str + '\n';
default:
assertNever(newLine, 'Unexpected value');
}
}