Skip to main content
Glama

Cyberlink MCP Server

by dasein108
utils.ts1.62 kB
import { DateTime } from 'luxon'; type Milliseconds = string | number; const millisecondsToNanoseconds = (milliseconds: Milliseconds): string => (BigInt(milliseconds) * 1000000n).toString(); /** * Converts a millisecond timestamp string to nanosecond timestamp string * @param milliseconds Timestamp in milliseconds * @param defaultMilliseconds Value to return if milliseconds is undefined (defaults to empty string) * @returns Timestamp in nanoseconds as string, or defaultValue if input is undefined */ export function millisecondsToNanosecondsWithDefault( milliseconds: Milliseconds | undefined, defaultMilliseconds: Milliseconds | undefined = undefined ): string | undefined { if (milliseconds) { return millisecondsToNanoseconds(milliseconds); } return defaultMilliseconds ? millisecondsToNanoseconds(defaultMilliseconds) : undefined; } export function nanosToISOString(nanos: string | undefined): string | undefined { if (!nanos) return undefined; try { // Convert string nanoseconds to milliseconds (as number) const ms = Number(BigInt(nanos) / 1000000n); return DateTime.fromMillis(ms, { zone: 'utc' }).toISO() || undefined; } catch { return undefined; } } export function parseToNanos(datetimeStr: string): string { // Parse with Luxon, default to UTC if no zone let dt = DateTime.fromISO(datetimeStr, { setZone: true }); if (!dt.isValid) throw new Error(`Invalid datetime: ${datetimeStr}`); // If no timezone info, treat as UTC if (!dt.zoneName || dt.zoneName === 'local') { dt = dt.toUTC(); } return (dt.toMillis() * 1_000_000).toString(); }

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/dasein108/mcp-cw-graph'

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