set-log-level
Adjust logging levels in the CCXT MCP Server to debug, info, warning, or error for efficient monitoring and troubleshooting of cryptocurrency exchange integrations.
Instructions
Set logging level
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| level | Yes | Logging level to set |
Implementation Reference
- src/index.ts:177-185 (handler)Inline asynchronous handler function for the 'set-log-level' tool. Receives the level parameter, calls the setLogLevel helper, and returns a text content response confirming the change.}, async ({ level }) => { setLogLevel(level); return { content: [{ type: "text", text: `Log level set to ${level}.` }] }; });
- src/index.ts:176-176 (schema)Zod schema definition for the tool input parameter 'level', using enum matching the supported log levels.level: z.enum(["debug", "info", "warning", "error"]).describe("Logging level to set")
- src/index.ts:175-185 (registration)Registers the 'set-log-level' tool on the MCP server with description, input schema, and handler function.server.tool("set-log-level", "Set logging level", { level: z.enum(["debug", "info", "warning", "error"]).describe("Logging level to set") }, async ({ level }) => { setLogLevel(level); return { content: [{ type: "text", text: `Log level set to ${level}.` }] }; });
- src/utils/logging.ts:62-85 (helper)Core helper function that sets the global currentLogLevel based on string input (mapping to enum values) or direct LogLevel enum, and logs the change.export function setLogLevel(level: LogLevel | string): void { if (typeof level === 'string') { switch (level.toLowerCase()) { case 'debug': currentLogLevel = LogLevel.DEBUG; break; case 'info': currentLogLevel = LogLevel.INFO; break; case 'warning': currentLogLevel = LogLevel.WARNING; break; case 'error': currentLogLevel = LogLevel.ERROR; break; default: throw new Error(`Unknown log level: ${level}`); } } else { currentLogLevel = level; } log(LogLevel.INFO, `Log level set to: ${LogLevel[currentLogLevel]}`); }
- src/utils/logging.ts:9-14 (schema)Type definition enum for LogLevel values, used internally by setLogLevel and matching the strings in the tool schema.export enum LogLevel { DEBUG = 0, INFO = 1, WARNING = 2, ERROR = 3 }