UNPKG

mcp-ai-agent-guidelines

Version:

A comprehensive Model Context Protocol server providing advanced tools, resources, and prompts for implementing AI agent best practices

38 lines 1.12 kB
/** * Deprecation warning utility * Emits warnings once per tool per session to avoid spam */ import { logger } from "./logger.js"; /** * Set of tools that have already emitted deprecation warnings in this session */ const warned = new Set(); /** * Emit a deprecation warning for a tool * Warning is emitted only once per tool per session * * @param options - Deprecation configuration */ export function emitDeprecationWarning(options) { if (warned.has(options.tool)) { return; } warned.add(options.tool); logger.warn(`Tool "${options.tool}" is deprecated since ${options.deprecatedIn}. ` + `Use "${options.replacement}" instead. ` + `Will be removed in ${options.removedIn}.`, { type: "deprecation", tool: options.tool, replacement: options.replacement, deprecatedIn: options.deprecatedIn, removedIn: options.removedIn, }); } /** * Reset deprecation warnings (for testing) * This clears the set of warned tools */ export function resetDeprecationWarnings() { warned.clear(); } //# sourceMappingURL=deprecation.js.map