Skip to main content
Glama
lkb2k

Gradle Tomcat MCP Server

by lkb2k

get_logs

Retrieve and filter application logs by lines, level, time, and source to monitor and troubleshoot Gradle-based Tomcat applications efficiently.

Instructions

Retrieve log entries

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
levelNoMinimum log level (DEBUG, INFO, WARN, ERROR)
linesNoNumber of recent log lines to retrieve (default: 100)
sinceNoISO 8601 timestamp to filter logs from
sourceNoFilter by log source (stdout, stderr)

Implementation Reference

  • The main implementation of the get_logs tool. Filters the in-memory log buffer by level (minimum priority), since timestamp, source, and returns the most recent 'lines' number of matching log entries.
    getLogs(options = {}) { const { lines = 100, level = null, since = null, source = null } = options; let filteredLogs = [...this.logBuffer]; if (level) { const levelPriority = { 'DEBUG': 0, 'INFO': 1, 'WARN': 2, 'ERROR': 3 }; const minPriority = levelPriority[level.toUpperCase()] || 0; filteredLogs = filteredLogs.filter(log => (levelPriority[log.level] || 0) >= minPriority ); } if (since) { const sinceDate = new Date(since); filteredLogs = filteredLogs.filter(log => new Date(log.timestamp) >= sinceDate ); } if (source) { filteredLogs = filteredLogs.filter(log => log.source === source ); } return filteredLogs.slice(-lines); }
  • Input schema for the get_logs tool, defining parameters: lines (number, default 100), level (enum), since (ISO string), source (enum).
    inputSchema: { type: "object", properties: { lines: { type: "number", description: "Number of recent log lines to retrieve (default: 100)", default: 100 }, level: { type: "string", description: "Minimum log level (DEBUG, INFO, WARN, ERROR)", enum: ["DEBUG", "INFO", "WARN", "ERROR"] }, since: { type: "string", description: "ISO 8601 timestamp to filter logs from" }, source: { type: "string", description: "Filter by log source (stdout, stderr)", enum: ["stdout", "stderr"] } } }
  • Registration of the get_logs tool in the TOOLS export array, including name, description, and input schema.
    { name: "get_logs", description: "Retrieve log entries", inputSchema: { type: "object", properties: { lines: { type: "number", description: "Number of recent log lines to retrieve (default: 100)", default: 100 }, level: { type: "string", description: "Minimum log level (DEBUG, INFO, WARN, ERROR)", enum: ["DEBUG", "INFO", "WARN", "ERROR"] }, since: { type: "string", description: "ISO 8601 timestamp to filter logs from" }, source: { type: "string", description: "Filter by log source (stdout, stderr)", enum: ["stdout", "stderr"] } } } },
  • Dispatch handler in handleToolCall function that maps tool arguments to logManager.getLogs call.
    case "get_logs": return logManager.getLogs({ lines: args.lines, level: args.level, since: args.since, source: args.source });

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lkb2k/mcp-gradle'

If you have feedback or need assistance with the MCP directory API, please join our Discord server