/**
 * Tool registry for the Forge Management MCP.
 *
 * Each tool is an INTENT (not a 1:1 REST passthrough). Handlers call `lib/`
 * functions in-process — never SQL from the client, never self-HTTP. The one
 * exception is workspace mutations, which go through the workspace daemon HTTP
 * API per the single-writer rule (see workspace.ts).
 */

import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import type { ManagementContext } from '../server';
import { registerProjectTools } from './projects';
import { registerTaskTools } from './tasks';
import { registerLogTools } from './logs';
import { registerIntegrationTools } from './integrations';
import { registerHelpTools } from './help';
import { registerPipelineTools } from './pipelines';
import { registerMarketplaceTools } from './marketplace';
import { registerWorkspaceTools } from './workspace';
import { registerObservabilityTools } from './observability';
import { registerAutomationTools } from './automation';
import { registerConnectorTools } from './connectors';

export function registerTools(server: McpServer, _ctx: ManagementContext): void {
  registerProjectTools(server);     // forge_list_projects, forge_register_project, forge_unregister_project
  registerTaskTools(server);        // forge_{list,get,create,cancel}_task(s)
  registerLogTools(server);         // forge_tail_logs
  registerIntegrationTools(server); // forge_list_agents, forge_set_default_agent, forge_set_agent_model
  registerHelpTools(server);        // forge_help
  registerPipelineTools(server);    // forge_{list_workflows,run_pipeline,get_pipeline,cancel_pipeline,list_pipeline_runs,create_pipeline}
  registerMarketplaceTools(server); // forge_marketplace_search, forge_marketplace_install
  registerWorkspaceTools(server);   // forge_list_workspace_agents, forge_add_workspace_agent
  registerObservabilityTools(server); // forge_status, forge_get_usage
  registerAutomationTools(server);  // forge_{list,upsert,manage}_schedule, forge_{list,manage}_job
  registerConnectorTools(server);   // forge_list_connectors, forge_configure_connector

  // ── TODO v1b (needs additive endpoints) ──
  // forge_stream_logs (SSE) · forge_setup_key
}
