Adding New Tools

Adding New Tools

  1. Define Tool in Source

// In appropriate file (e.g., zetrix-client.ts)
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name === "zetrix_new_tool") {
    const { param1 } = request.params.arguments as { param1: string };
    
    try {
      const result = await yourFunction(param1);
      return {
        content: [{
          type: "text",
          text: JSON.stringify(result, null, 2)
        }]
      };
    } catch (error) {
      return {
        content: [{
          type: "text",
          text: `Error: ${error.message}`
        }],
        isError: true
      };
    }
  }
});
  1. Register Tool

  1. Add Tests

  1. Update Documentation

    • Add to README.md

    • Update docs/EXAMPLES.md

    • Include in this GITDOC

  2. Submit Pull Request

    • Clear description

    • Tests included

    • Documentation updated


Code Guidelines

Last updated