get_server_info
Retrieve version and build details to verify server status and compatibility for time manipulation operations.
Instructions
Get server version and build information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/getServerInfo.ts:104-143 (handler)The main handler function implementing the get_server_info tool. It collects server version from package.json, git revision/branch/dirty status, Node version, and timezone.export function getServerInfo(_params?: unknown): ServerInfo { debug.server('getServerInfo called'); // Try to read build-time version info first const versionJson = readVersionJson(); // Always use package.json for version (source of truth) const version = getPackageVersion(); // Use build-time info if available, otherwise detect at runtime const revision = versionJson?.revision ?? getGitRevision(); const branch = versionJson?.branch ?? getGitBranch(); // Build the response const info: ServerInfo = { version, revision, branch, node_version: process.version, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, }; // Add optional fields if available if (versionJson?.buildDate) { info.build_date = versionJson.buildDate; } if (versionJson?.buildNumber) { info.build_number = versionJson.buildNumber; } // Include dirty status if available const dirty = versionJson?.dirty ?? getGitDirtyStatus(); if (dirty !== undefined) { info.dirty = dirty; } debug.server('getServerInfo returning: v%s, rev: %s, branch: %s', version, revision, branch); return info; }
- src/tools/getServerInfo.ts:12-21 (schema)TypeScript interface defining the structure of the ServerInfo object returned by the getServerInfo tool.interface ServerInfo { version: string; revision: string; branch: string; dirty?: boolean; build_date?: string; build_number?: string; node_version: string; timezone: string; }
- src/index.ts:33-40 (registration)Tool registration in TOOL_DEFINITIONS array, specifying name, description, and empty input schema for the tools/list endpoint.{ name: 'get_server_info', description: 'Get server version and build information', inputSchema: { type: 'object' as const, properties: {}, }, },
- src/index.ts:257-257 (registration)Mapping of tool name 'get_server_info' to the getServerInfo handler function in TOOL_FUNCTIONS for tools/call execution.get_server_info: (params: unknown) => getServerInfo(params),
- src/tools/getServerInfo.ts:69-79 (helper)Helper function to extract version from package.json, used by getServerInfo.function getPackageVersion(): string { try { const packagePath = path.join(__dirname, '../../package.json'); // eslint-disable-next-line security/detect-non-literal-fs-filename const packageContent = fs.readFileSync(packagePath, 'utf8'); const packageData = JSON.parse(packageContent) as { version?: string }; return packageData.version ?? '1.0.0'; } catch { return '1.0.0'; } }