Skip to main content
Glama

jpl_jd_cal

Convert between Julian Day numbers and calendar dates for astronomical calculations and timekeeping in space missions.

Instructions

Julian Day number to/from calendar date/time converter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jdNoJulian date to convert to calendar date
cdNoCalendar date to convert to Julian date (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss format)

Implementation Reference

  • The core handler function `jdCalHandler` that executes the `jpl_jd_cal` tool. It validates input, transforms parameters, calls the JPL JD Calendar API, adds result as resource, and returns formatted JSON response.
    export async function jdCalHandler(args: Record<string, any>) { try { // Base URL for the JD Calendar API const baseUrl = 'https://ssd-api.jpl.nasa.gov/jd_cal.api'; // Validate parameters if (!args.jd && !args.cd) { return { content: [{ type: "text", text: "Error: Either a Julian date (jd) or calendar date (cd) must be provided." }], isError: true }; } // Transform parameter names from underscore to hyphenated format const transformedParams = transformParamsToHyphenated(args); // Make the API request const response = await axios.get(baseUrl, { params: transformedParams }); const data = response.data; // Add response to resources const resourceUri = `jpl://jd_cal/${args.jd || args.cd}`; addResource(resourceUri, { name: `Julian Date / Calendar Date Conversion: ${args.jd || args.cd}`, mimeType: "application/json", text: JSON.stringify(data, null, 2) }); // Format the response return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error accessing JPL Julian Date Calendar API: ${error.message}` }], isError: true }; } }
  • Input schema definition for the `jpl_jd_cal` tool in the tools/list response, specifying parameters `jd` and `cd`.
    name: "jpl_jd_cal", description: "Julian Day number to/from calendar date/time converter", inputSchema: { type: "object", properties: { jd: { type: "string", description: "Julian date to convert to calendar date" }, cd: { type: "string", description: "Calendar date to convert to Julian date (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss format)" } } } },
  • src/index.ts:513-516 (registration)
    Registration of the `jpl_jd_cal` tool in the tools/manifest response, providing name, id, and description.
    name: "jpl_jd_cal", id: "jpl/jd_cal", description: "Julian Day number to/from calendar date/time converter" },
  • src/index.ts:2110-2116 (registration)
    Global registration of `mcp__jpljd_cal` tool wrapper that delegates to the `jpl/jd_cal` handler.
    registerGlobalTool('mcp__jpljd_cal', async (args: Record<string, any>) => { serverInstance?.sendLoggingMessage({ level: "info", data: `MCP JPL JD Calendar called with args: ${JSON.stringify(args)}`, }); return await handleToolCall('jpl/jd_cal', args); });

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/ProgramComputer/NASA-MCP-server'

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