timescale
Retrieve geological time period information by entering an age in millions of years before present. This tool provides detailed data about specific geological eras from the Macrostrat database.
Instructions
Get information about a time period
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| age | Yes | Age in millions of years before present |
Implementation Reference
- src/index.ts:1063-1078 (handler)The handler function for the 'timescale' tool. It accepts an 'age' input, constructs a query to the Macrostrat API /v2/defs/intervals endpoint using timescale_id=11, fetches the data, and returns it as formatted JSON text.async (request) => { const { age } = request; const params = new URLSearchParams({ timescale_id: "11", age: age.toString(), }); const response = await fetch(`${getApiEndpoint("base")}/v2/defs/intervals?${params}`); const data = await response.json(); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }
- src/index.ts:1056-1062 (schema)Input schema specification for the 'timescale' tool, including title, description, and required 'age' parameter (number).{ title: "Timescale", description: "Get information about a time period", inputSchema: { age: z.number().describe("Age in millions of years before present"), } },
- src/index.ts:1054-1079 (registration)Registration of the 'timescale' MCP tool using server.registerTool, including the tool name, schema, and handler function.server.registerTool( "timescale", { title: "Timescale", description: "Get information about a time period", inputSchema: { age: z.number().describe("Age in millions of years before present"), } }, async (request) => { const { age } = request; const params = new URLSearchParams({ timescale_id: "11", age: age.toString(), }); const response = await fetch(`${getApiEndpoint("base")}/v2/defs/intervals?${params}`); const data = await response.json(); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } );