Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
/**
* Json-schema-to-zod Example
*
* This example demonstrates how to use Composio SDK for json-schema-to-zod.
*
* Prerequisites:
* 1. Set up your COMPOSIO_API_KEY in the .env file
* 3. Run the example: pnpm start
*/
import { Composio, jsonSchemaToZodSchema } from '@composio/core';
import { zodToJsonSchema } from 'zod-to-json-schema';
import 'dotenv/config';
/**
* Initialize Composio
*/
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
});
/**
* Main function to run the example
*/
async function main() {
try {
console.log('π Starting Json-schema-to-zod Example...');
// Get available tools
const tool = await composio.tools.getRawComposioToolBySlug('GOOGLECALENDAR_PATCH_EVENT');
console.log(JSON.stringify(tool.inputParameters, null, 2));
const zodSchema = jsonSchemaToZodSchema(tool.inputParameters ?? {});
console.log(JSON.stringify(zodToJsonSchema(zodSchema), null, 2));
// TODO: Add your example implementation here
console.log('π Implement your json-schema-to-zod logic here!');
} catch (error) {
console.error('β Error running example:', error);
process.exitCode = 1;
}
}
// Run the example
main().catch(error => {
console.error(error);
process.exitCode = 1;
});