Extending Firebreak
Learn how to extend Firebreak's capabilities without violating existing architectural boundaries.
3 min read
•Production Verified
Recipe: Adding a New MCP Tool
To add a new tool (e.g. get_service_health):
apps/mcp/src/modules/services/services.tools.ts
@Tool({
name: "get_service_health",
title: "Get service health",
description: "Runs an instant health check probe against a service's health_url.",
inputSchema: GetServiceHealthInput,
annotations: { readOnlyHint: false, idempotentHint: true },
})
@UseGuards(McpKeyGuard)
async getServiceHealth(raw: unknown, ctx: ExecutionContext) {
const input = GetServiceHealthInput.parse(raw);
const id = identity(ctx);
requireScope(id, "services:read");
return runTool(ctx, () => probeServiceNow(coreCtx(id), input.serviceId));
}Recipe: Adding a Database Table
Define the table in packages/core/src/db/schema.ts and run npx drizzle-kit push:
packages/core/src/db/schema.ts
export const audit_logs = pgTable("audit_logs", {
id: text("id").primaryKey(),
workspaceId: text("workspace_id").notNull().references(() => workspaces.id, { onDelete: "cascade" }),
action: text("action").notNull(),
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
});