π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
checkpoint: File edit:
rUv86c0dd7d461b
diff --git a/.claude/statusline.sh b/.claude/statusline.shindex 14561fc03c..4f4d6823c3 100755--- a/.claude/statusline.sh+++ b/.claude/statusline.sh@@ -193,6 +193,15 @@ if [ "$INTEGRATION_STATUS" = "β" ]; thenINTEGRATION_COLOR="${BRIGHT_CYAN}"fi+# Get model name from Claude Code input+MODEL_NAME=""+if [ "$CLAUDE_INPUT" != "{}" ]; then+ MODEL_NAME=$(echo "$CLAUDE_INPUT" | jq -r '.model.display_name // ""' 2>/dev/null)+fi++# Get current directory+CURRENT_DIR=$(basename "$PROJECT_DIR" 2>/dev/null || echo "claude-flow")+# Build colorful output with better formattingOUTPUT=""@@ -202,6 +211,9 @@ OUTPUT="${OUTPUT}${INTEGRATION_COLOR}${INTEGRATION_STATUS} ${BRIGHT_CYAN}agenticif [ -n "$GIT_BRANCH" ]; thenOUTPUT="${OUTPUT} ${DIM}β${RESET} ${BRIGHT_BLUE}β ${GIT_BRANCH}${RESET}"fi+if [ -n "$MODEL_NAME" ]; then+ OUTPUT="${OUTPUT} ${DIM}β${RESET} ${PURPLE}${MODEL_NAME}${RESET}"+fi# Separator lineOUTPUT="${OUTPUT}\n${DIM}βββββββββββββββββββββββββββββββββββββββββββββββββββββ${RESET}"diff --git a/v3/mcp/tools/index.ts b/v3/mcp/tools/index.tsnew file mode 100644index 0000000000..535824eafa--- /dev/null+++ b/v3/mcp/tools/index.ts@@ -0,0 +1,300 @@+/**+ * V3 MCP Tools - Central Export+ *+ * Exports all MCP tools and provides a getAllTools() function+ * for convenient registration.+ *+ * Implements ADR-005: MCP-First API Design+ *+ * Tool Categories:+ * - Agent Tools: agent/spawn, agent/list, agent/terminate, agent/status+ * - Swarm Tools: swarm/init, swarm/status, swarm/scale+ * - Memory Tools: memory/store, memory/search, memory/list+ * - Config Tools: config/load, config/save, config/validate+ */++import { MCPTool } from '../types.js';++// Import tool groups+import { agentTools } from './agent-tools.js';+import { swarmTools } from './swarm-tools.js';+import { memoryTools } from './memory-tools.js';+import { configTools } from './config-tools.js';++// ============================================================================+// Individual Tool Exports+// ============================================================================++// Agent tools+export {+ spawnAgentTool,+ listAgentsTool,+ terminateAgentTool,+ agentStatusTool,+ agentTools,+} from './agent-tools.js';++// Swarm tools+export {+ initSwarmTool,+ swarmStatusTool,+ scaleSwarmTool,+ swarmTools,+} from './swarm-tools.js';++// Memory tools+export {+ storeMemoryTool,+ searchMemoryTool,+ listMemoryTool,+ memoryTools,+} from './memory-tools.js';++// Config tools+export {+ loadConfigTool,+ saveConfigTool,+ validateConfigTool,+ configTools,+} from './config-tools.js';++// ============================================================================+// Tool Registry+// ============================================================================++/**+ * Get all MCP tools+ *+ * Returns all available MCP tools in a single array for convenient+ * registration with the MCP server.+ *+ * @returns Array of all MCP tools+ *+ * @example+ * ```typescript+ * import { getAllTools } from './mcp/tools/index.js';+ *+ * const tools = getAllTools();+ * server.registerTools(tools);+ * ```+ */+export function getAllTools(): MCPTool[] {+ return [+ ...agentTools,+ ...swarmTools,+ ...memoryTools,+ ...configTools,+ ];+}++/**+ * Get tools by category+ *+ * Returns all tools belonging to a specific category.+ *+ * @param category - Tool category to filter by+ * @returns Array of tools in the specified category+ *+ * @example+ * ```typescript+ * import { getToolsByCategory } from './mcp/tools/index.js';+ *+ * const agentTools = getToolsByCategory('agent');+ * const memoryTools = getToolsByCategory('memory');+ * ```+ */+export function getToolsByCategory(category: string): MCPTool[] {+ const allTools = getAllTools();+ return allTools.filter(tool => tool.category === category);+}++/**+ * Get tool by name+ *+ * Returns a specific tool by its name.+ *+ * @param name - Tool name (e.g., 'agent/spawn')+ * @returns The tool if found, undefined otherwise+ *+ * @example+ * ```typescript+ * import { getToolByName } from './mcp/tools/index.js';+ *+ * const spawnTool = getToolByName('agent/spawn');+ * if (spawnTool) {+ * await spawnTool.handler({ agentType: 'coder' });+ * }+ * ```+ */+export function getToolByName(name: string): MCPTool | undefined {+ const allTools = getAllTools();+ return allTools.find(tool => tool.name === name);+}++/**+ * Get tools by tag+ *+ * Returns all tools that have a specific tag.+ *+ * @param tag - Tag to filter by+ * @returns Array of tools with the specified tag+ *+ * @example+ * ```typescript+ * import { getToolsByTag } from './mcp/tools/index.js';+ *+ * const lifecycleTools = getToolsByTag('lifecycle');+ * const agentdbTools = getToolsByTag('agentdb');+ * ```+ */+export function getToolsByTag(tag: string): MCPTool[] {+ const allTools = getAllTools();+ return allTools.filter(tool => tool.tags?.includes(tag));+}++/**+ * Get tool statistics+ *+ * Returns statistics about the available tools.+ *+ * @returns Object containing tool statistics+ *+ * @example+ * ```typescript+ * import { getToolStats } from './mcp/tools/index.js';+ *+ * const stats = getToolStats();+ * console.log(`Total tools: ${stats.total}`);+ * console.log(`Categories: ${stats.categories.join(', ')}`);+ * ```+ */+export function getToolStats(): {+ total: number;+ byCategory: Record<string, number>;+ categories: string[];+ tags: string[];+ cacheable: number;+ deprecated: number;+} {+ const allTools = getAllTools();++ const byCategory: Record<string, number> = {};+ const categories = new Set<string>();+ const tags = new Set<string>();+ let cacheable = 0;+ let deprecated = 0;++ allTools.forEach(tool => {+ // Count by category+ if (tool.category) {+ categories.add(tool.category);+ byCategory[tool.category] = (byCategory[tool.category] || 0) + 1;+ }++ // Collect tags+ tool.tags?.forEach(tag => tags.add(tag));++ // Count cacheable tools+ if (tool.cacheable) {+ cacheable++;+ }++ // Count deprecated tools+ if (tool.deprecated) {+ deprecated++;+ }+ });++ return {+ total: allTools.length,+ byCategory,+ categories: Array.from(categories).sort(),+ tags: Array.from(tags).sort(),+ cacheable,+ deprecated,+ };+}++/**+ * Validate tool registration+ *+ * Checks if all tools have valid schemas and handlers.+ *+ * @returns Validation result+ *+ * @example+ * ```typescript+ * import { validateToolRegistration } from './mcp/tools/index.js';+ *+ * const validation = validateToolRegistration();+ * if (!validation.valid) {+ * console.error('Tool validation failed:', validation.issues);+ * }+ * ```+ */+export function validateToolRegistration(): {+ valid: boolean;+ issues: Array<{ tool: string; issue: string }>;+} {+ const allTools = getAllTools();+ const issues: Array<{ tool: string; issue: string }> = [];++ allTools.forEach(tool => {+ // Check required fields+ if (!tool.name) {+ issues.push({ tool: 'unknown', issue: 'Tool is missing name' });+ return;+ }++ if (!tool.description) {+ issues.push({ tool: tool.name, issue: 'Missing description' });+ }++ if (!tool.inputSchema) {+ issues.push({ tool: tool.name, issue: 'Missing inputSchema' });+ }++ if (!tool.handler || typeof tool.handler !== 'function') {+ issues.push({ tool: tool.name, issue: 'Missing or invalid handler' });+ }++ // Check schema validity+ if (tool.inputSchema) {+ if (!tool.inputSchema.type) {+ issues.push({ tool: tool.name, issue: 'inputSchema missing type' });+ }++ if (tool.inputSchema.type === 'object' && !tool.inputSchema.properties) {+ issues.push({ tool: tool.name, issue: 'Object schema missing properties' });+ }+ }++ // Check for duplicate names+ const duplicates = allTools.filter(t => t.name === tool.name);+ if (duplicates.length > 1) {+ issues.push({ tool: tool.name, issue: 'Duplicate tool name' });+ }+ });++ return {+ valid: issues.length === 0,+ issues,+ };+}++// ============================================================================+// Default Export+// ============================================================================++export default {+ getAllTools,+ getToolsByCategory,+ getToolByName,+ getToolsByTag,+ getToolStats,+ validateToolRegistration,+ agentTools,+ swarmTools,+ memoryTools,+ configTools,+};