it-tools-mcp
Version:
MCP-compliant server access to over 100 IT tools and utilities commonly used by developers, system administrators, and IT professionals.
24 lines (23 loc) • 787 B
JavaScript
import { z } from "zod";
import readLastLines from "read-last-lines";
export function registerTail(server) {
server.registerTool("tail", {
inputSchema: {
file: z.string().describe("File path"),
lines: z.number().default(10).describe("Number of lines")
},
// VS Code compliance annotations
annotations: {
title: "Tail",
readOnlyHint: false
}
}, async ({ file, lines }) => {
try {
const out = await readLastLines.read(file, lines);
return { content: [{ type: "text", text: out }] };
}
catch (error) {
return { content: [{ type: "text", text: `tail failed: ${error instanceof Error ? error.message : error}` }] };
}
});
}