MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / applyFormat

Function applyFormat

packages/mcp-server/src/server.ts:25–31  ·  view source on GitHub ↗
(content: string, format: string | undefined, toolName: string)

Source from the content-addressed store, hash-verified

23const JSON_DEFAULT_TOOLS = new Set(['execute_sql', 'get_schema'])
24
25function applyFormat(content: string, format: string | undefined, toolName: string): string {
26 const effectiveFormat = format ?? (JSON_DEFAULT_TOOLS.has(toolName) ? 'json' : 'text')
27 if (effectiveFormat === 'json') return content
28
29 const textResult = formatToolResultAsText(content)
30 return textResult ?? content
31}
32
33function registerTools(server: McpServer, dbManager: McpDatabaseManager): void {
34 for (const tool of MCP_TOOL_REGISTRY) {

Callers 1

registerToolsFunction · 0.85

Calls 1

formatToolResultAsTextFunction · 0.90

Tested by

no test coverage detected