From Muse to TeGo: Bringing Cloud AI Agents into Real Work
Muse shows what a cloud-based personal agent can do. TeGo brings the same goal-driven approach into enterprise work, with digital employees, tools, and clear human oversight.
Published November 19, 2024. For current capabilities, see the product overview.
Decorators are magic.
Not the fake, hand-wavy kind of magic. The real kind - where complex operations become simple, verbose code becomes elegant, and development becomes… fun.
When we built @zhama/mcp-server at Zhama, we had one goal: make building AI tools for Claude Desktop feel less like wrestling with configuration and more like writing poetry.
The answer? TypeScript decorators.
Let me show you why building AI tools with decorators is the most enjoyable way to extend Claude’s capabilities.
I remember the exact moment. It was 2 AM, I was on my fifth cup of coffee, staring at 200 lines of JSON Schema definitions for a simple email tool. My brain was melting.
Then I thought: “What if I could just… describe what I want?”
@Tool({
name: 'send_email',
description: 'Send an email',
parameters: [
{ name: 'to', type: 'string', required: true },
{ name: 'subject', type: 'string', required: true },
{ name: 'body', type: 'string', required: true }
]
})
class EmailTool extends BaseTool {
async executeInternal(params) {
// Just send the email
return await sendEmail(params);
}
}
That’s it. No schema objects. No handler registration. No request routing. Just pure, declarative beauty.
I deleted 180 lines of boilerplate code and went to bed happy.
Look at this:
@Tool({
name: 'get_weather',
description: 'Get current weather for any city',
parameters: [
{ name: 'city', type: 'string', description: 'City name', required: true }
]
})
You can read this. You don’t need to be a TypeScript expert. You don’t need to understand JSON Schema. You just… understand it.
Compare that to the traditional approach:
const weatherToolSchema = {
type: 'object',
properties: {
city: {
type: 'string',
description: 'City name'
}
},
required: ['city']
};
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [{
name: 'get_weather',
description: 'Get current weather for any city',
inputSchema: weatherToolSchema
}]
}));
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === 'get_weather') {
// Finally, your actual code
}
});
Which would you rather read? Which would you rather write?
In traditional approaches, your tool definition is scattered across multiple places:
Want to change a parameter? Visit four different places.
With decorators, everything lives in one place:
@Tool({
name: 'search_database',
description: 'Search the product database for items',
parameters: [
{ name: 'query', type: 'string', description: 'Search query', required: true },
{ name: 'limit', type: 'number', description: 'Max results', required: false }
]
})
class SearchTool extends BaseTool {
protected toolDefinition = {
name: 'search_database',
description: 'Search products',
parameters: []
};
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { query, limit = 10 } = params as { query: string; limit?: number };
// Validation
if (query.length < 2) {
throw new Error('Query must be at least 2 characters');
}
// Execution
const results = await this.database.search(query, limit);
// Response
return {
query,
count: results.length,
results
};
}
}
Everything about this tool is right here. Definition, validation, logic, response. No hunting through files.
Decorators compose beautifully. Want to add authentication? Logging? Rate limiting? Stack decorators:
@Tool({
name: 'delete_user',
description: 'Delete a user account (admin only)',
parameters: [
{ name: 'userId', type: 'string', required: true }
]
})
@RequireAuth('admin')
@RateLimit({ maxCalls: 10, windowMs: 60000 })
@AuditLog()
class DeleteUserTool extends BaseTool {
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
// Your logic - authentication, rate limiting, and logging are automatic
return await this.userService.delete(params.userId);
}
}
Each decorator adds a capability. Clean, modular, composable.
Let me share some tools I’ve built with @zhama/mcp-server that made me smile while coding.
@Tool({
name: 'count_users',
description: 'Count total users in the database',
parameters: []
})
class CountUsersTool extends BaseTool {
protected toolDefinition = { name: 'count_users', description: 'Count users', parameters: [] };
protected async executeInternal(): Promise<unknown> {
return { count: await this.db.users.count() };
}
}
That’s the entire tool. Seven lines of actual code. Works perfectly in Claude.
Compare to traditional approach: 60+ lines with schema definitions, handler registration, response formatting.
@Tool({
name: 'shorten_url',
description: 'Create a shortened URL using bit.ly',
parameters: [
{ name: 'url', type: 'string', description: 'URL to shorten', required: true }
]
})
class ShortenUrlTool extends BaseTool {
protected toolDefinition = { name: 'shorten_url', description: 'Shorten URL', parameters: [] };
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { url } = params as { url: string };
const response = await fetch('https://api-ssl.bitly.com/v4/shorten', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BITLY_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ long_url: url })
});
const data = await response.json();
return {
original: url,
shortened: data.link,
success: true
};
}
}
Beautiful. The decorator describes the interface, the method implements the logic. Clean separation of concerns.
@Tool({
name: 'register_user',
description: 'Register a new user account',
parameters: [
{ name: 'email', type: 'string', description: 'User email', required: true },
{ name: 'username', type: 'string', description: 'Username', required: true },
{ name: 'password', type: 'string', description: 'Password', required: true }
]
})
class RegisterUserTool extends BaseTool {
protected toolDefinition = { name: 'register_user', description: 'Register user', parameters: [] };
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { email, username, password } = params as {
email: string;
username: string;
password: string;
};
// Validation (automatic error formatting)
if (!this.isValidEmail(email)) {
throw new Error('Invalid email format');
}
if (username.length < 3) {
throw new Error('Username must be at least 3 characters');
}
if (password.length < 8) {
throw new Error('Password must be at least 8 characters');
}
// Registration
const user = await this.userService.create({
email,
username,
passwordHash: await this.hashPassword(password)
});
return {
success: true,
userId: user.id,
message: 'User registered successfully'
};
}
private isValidEmail(email: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
private async hashPassword(password: string): Promise<string> {
// Password hashing logic
return await bcrypt.hash(password, 10);
}
}
Everything is where it should be. Validation logic with the tool. Helper methods are private. Clean, maintainable, testable.
Once you start thinking in decorators, patterns emerge. Here’s my personal collection:
@Tool({
name: 'list_files',
description: 'List files in a directory',
parameters: [
{ name: 'path', type: 'string', description: 'Directory path', required: true },
{ name: 'limit', type: 'number', description: 'Max files to return', required: false }
]
})
class ListFilesTool extends BaseTool {
protected toolDefinition = { name: 'list_files', description: 'List files', parameters: [] };
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { path, limit = 100 } = params as { path: string; limit?: number };
const files = await fs.readdir(path);
return {
path,
files: files.slice(0, limit),
total: files.length,
limited: files.length > limit
};
}
}
Destructuring with defaults. So clean, so JavaScript.
@Tool({
name: 'convert_temperature',
description: 'Convert temperature between units',
parameters: [
{ name: 'value', type: 'number', description: 'Temperature value', required: true },
{ name: 'from', type: 'string', description: 'Source unit: celsius, fahrenheit, kelvin', required: true },
{ name: 'to', type: 'string', description: 'Target unit: celsius, fahrenheit, kelvin', required: true }
]
})
class ConvertTemperatureTool extends BaseTool {
protected toolDefinition = { name: 'convert_temperature', description: 'Convert temperature', parameters: [] };
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { value, from, to } = params as {
value: number;
from: 'celsius' | 'fahrenheit' | 'kelvin';
to: 'celsius' | 'fahrenheit' | 'kelvin';
};
const conversions = {
celsius: {
fahrenheit: (v: number) => (v * 9/5) + 32,
kelvin: (v: number) => v + 273.15
},
fahrenheit: {
celsius: (v: number) => (v - 32) * 5/9,
kelvin: (v: number) => ((v - 32) * 5/9) + 273.15
},
kelvin: {
celsius: (v: number) => v - 273.15,
fahrenheit: (v: number) => ((v - 273.15) * 9/5) + 32
}
};
if (from === to) {
return { value, unit: to };
}
const convert = conversions[from]?.[to];
if (!convert) {
throw new Error(`Cannot convert from ${from} to ${to}`);
}
return {
original: { value, unit: from },
converted: { value: convert(value), unit: to }
};
}
}
Type safety + lookup tables. Elegant and safe.
@Tool({
name: 'process_image',
description: 'Download, resize, and upload an image',
parameters: [
{ name: 'url', type: 'string', description: 'Image URL', required: true },
{ name: 'width', type: 'number', description: 'Target width', required: true },
{ name: 'height', type: 'number', description: 'Target height', required: true }
]
})
class ProcessImageTool extends BaseTool {
protected toolDefinition = { name: 'process_image', description: 'Process image', parameters: [] };
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { url, width, height } = params as {
url: string;
width: number;
height: number;
};
// Elegant async pipeline
const originalBuffer = await this.downloadImage(url);
const resizedBuffer = await this.resizeImage(originalBuffer, width, height);
const uploadedUrl = await this.uploadImage(resizedBuffer);
return {
original: url,
processed: uploadedUrl,
dimensions: { width, height },
success: true
};
}
private async downloadImage(url: string): Promise<Buffer> {
const response = await fetch(url);
return Buffer.from(await response.arrayBuffer());
}
private async resizeImage(buffer: Buffer, width: number, height: number): Promise<Buffer> {
// Image processing logic
return buffer; // Simplified
}
private async uploadImage(buffer: Buffer): Promise<string> {
// Upload logic
return 'https://cdn.example.com/processed.jpg'; // Simplified
}
}
Async/await chains read top to bottom. No callback hell, no promise chains, just clean flow.
@Tool({
name: 'charge_payment',
description: 'Process a payment charge',
parameters: [
{ name: 'amount', type: 'number', description: 'Amount in cents', required: true },
{ name: 'currency', type: 'string', description: 'Currency code', required: true },
{ name: 'customerId', type: 'string', description: 'Customer ID', required: true }
]
})
class ChargePaymentTool extends BaseTool {
protected toolDefinition = { name: 'charge_payment', description: 'Charge payment', parameters: [] };
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { amount, currency, customerId } = params as {
amount: number;
currency: string;
customerId: string;
};
try {
// Attempt charge
const charge = await this.stripe.charges.create({
amount,
currency,
customer: customerId
});
return {
success: true,
chargeId: charge.id,
amount,
currency
};
} catch (error) {
// Rich error context
this.logger.error('Payment failed', {
amount,
currency,
customerId,
error: error.message
});
throw new Error(
`Payment failed: ${error.message}. ` +
`Customer: ${customerId}, Amount: ${amount/100} ${currency.toUpperCase()}`
);
}
}
}
Error handling with context. When things fail, you know exactly what happened.
Once you’re comfortable with basics, try these advanced patterns:
Create your own decorators for common patterns:
// Custom decorator for caching
function Cached(ttlSeconds: number) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const originalMethod = descriptor.value;
const cache = new Map<string, { data: any; expires: number }>();
descriptor.value = async function (...args: any[]) {
const key = JSON.stringify(args);
const cached = cache.get(key);
if (cached && cached.expires > Date.now()) {
return cached.data;
}
const result = await originalMethod.apply(this, args);
cache.set(key, {
data: result,
expires: Date.now() + (ttlSeconds * 1000)
});
return result;
};
return descriptor;
};
}
// Use it
@Tool({
name: 'get_exchange_rate',
description: 'Get currency exchange rate',
parameters: [
{ name: 'from', type: 'string', required: true },
{ name: 'to', type: 'string', required: true }
]
})
class ExchangeRateTool extends BaseTool {
protected toolDefinition = { name: 'get_exchange_rate', description: 'Get rate', parameters: [] };
@Cached(300) // Cache for 5 minutes
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { from, to } = params as { from: string; to: string };
const response = await fetch(`https://api.exchangerate.com/${from}/${to}`);
const data = await response.json();
return { from, to, rate: data.rate, timestamp: Date.now() };
}
}
Stack decorators for powerful combinations:
@Tool({
name: 'admin_action',
description: 'Perform administrative action',
parameters: [
{ name: 'action', type: 'string', required: true },
{ name: 'target', type: 'string', required: true }
]
})
@RequireAuth('admin') // Must be admin
@RateLimit(5, 60000) // Max 5 per minute
@AuditLog() // Log all actions
@Retry(3, 1000) // Retry 3 times with 1s delay
class AdminActionTool extends BaseTool {
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
// All the decorator magic happens automatically
return await this.performAction(params);
}
}
At Zhama, we maintain 50+ AI tools across multiple Claude integrations. Decorators aren’t just nice - they’re essential.
Before decorators:
Developer: "Can you review my new tool?"
Reviewer: *scrolls through 150 lines*
Reviewer: "Where's the parameter validation?"
Developer: "Line 87"
Reviewer: "Where's the error handling?"
Developer: "Lines 120-145"
Reviewer: "Where's the actual logic?"
Developer: "Lines 60-75"
With decorators:
Developer: "Can you review my new tool?"
Reviewer: *reads 40 lines*
Reviewer: "Looks good, approved"
Code review time: 20 minutes → 5 minutes
New developer’s first day:
Before:
After:
Before decorators: 15 bugs per 1000 lines of code
With decorators: 3 bugs per 1000 lines of code
5x fewer bugs. Not because we’re better programmers - because there’s less code to mess up.
Let me be honest: Programming should feel good.
Not every day will be perfect, but when you’re building something, the tools should help, not hinder.
Decorators make me happy because:
That “too good to be true” feeling? It’s real. @zhama/mcp-server delivers it.
Ready to experience this yourself?
npm install @zhama/mcp-server
import { createMCPServer, BaseTool, Tool } from '@zhama/mcp-server';
@Tool({
name: 'hello',
description: 'Say hello to someone',
parameters: [
{ name: 'name', type: 'string', description: 'Name to greet', required: true }
]
})
class HelloTool extends BaseTool {
protected toolDefinition = {
name: 'hello',
description: 'Say hello',
parameters: []
};
protected async executeInternal(params: Record<string, unknown>): Promise<unknown> {
const { name } = params as { name: string };
return {
greeting: `Hello, ${name}! 👋`,
timestamp: new Date().toISOString()
};
}
}
// Create and run
createMCPServer('hello-server', '1.0.0')
.enableTools()
.addTool(new HelloTool())
.runStdio();
Save this. Build it. Watch it work.
The moment you see Claude use your decorator-defined tool, you’ll understand.
Developers using @zhama/mcp-server have built:
Every single one uses decorators. Every single developer loves it.
We’re adding more decorator features:
The decorator pattern scales infinitely.
When we built @zhama/mcp-server, we didn’t just want to make development faster. We wanted to make it joyful.
Decorators achieve that. They transform:
The result? Developers who smile while coding AI tools.
That’s not hyperbole. That’s our experience at Zhama and feedback from the community.
Try it yourself:
npm install @zhama/mcp-server
Five minutes from now, you’ll be smiling too.
Built with ❤️ and decorators by Zhama
Visit:
Share your decorator-powered tools! Tag us or open a discussion on GitHub - we love seeing what you build!
Muse shows what a cloud-based personal agent can do. TeGo brings the same goal-driven approach into enterprise work, with digital employees, tools, and clear human oversight.
TeGo v3.0.0 ships three things on the desktop: an always-on-top Mini Chat floating window, a unified Downloads center, and a fully rewritten Windows NSIS installer. This post focuses on the experience details and explains how the combination genuinely puts the digital avatar into daily work.
TeGo v3.0.0 ships 16 TeGo template skills covering the two highest-frequency industry chains: IT operations and cross-border e-commerce. Every skill comes with executable bash scripts — not 'prompt templates' but actually runnable. This post walks through every skill, the matching business workflows and how they integrate with per_user, template governance and BusinessMonitor.