# Function handleMonitorLegislativePipeline

- handleMonitorLegislativePipeline(args: unknown): Promise<ToolResult>

  Handles the monitor_legislative_pipeline MCP tool request.

  Monitors the European Parliament's active legislative pipeline by fetching real procedures and their authoritative event timelines from the EP API (`/procedures` + `/procedures/{id}/events`) and computing lifecycle-driven health metrics: percentile-based bottleneck detection, historical-median completion forecasts, and stage-aware dwell statistics.

  #### Parameters

  - args: unknown

    Raw tool arguments, validated against MonitorLegislativePipelineSchema

  #### Returns Promise<ToolResult>

  MCP tool result containing pipeline items with stage, lifecycle events, forecast basis, summary counts, detected bottlenecks (≥95th percentile dwell), pipeline health score, throughput rate, bottleneck index, and legislative momentum.

  #### Throws

  - If `args` fails schema validation (e.g., missing required fields or invalid format)
  - If the European Parliament API is unreachable for the primary procedure list

  #### Example

      const result = await handleMonitorLegislativePipeline({
        status: 'ACTIVE',
        committee: 'ENVI',
        dateFrom: '2024-01-01',
        dateTo: '2024-12-31',
        limit: 20
      });
      // Returns pipeline health score, stalled/active/completed counts,
      // bottleneck list, lifecycleEvents per procedure, and forecastBasis.

  #### Security

  - Input is validated with Zod before any API call.
  - Personal data in responses is minimised per GDPR Article 5(1)(c).
  - Bounded concurrency (≤8 parallel) on the event fan-out limits API load.
  - Lifecycle corpus is cached 30 min; only event types/dates are retained.
  - All requests are rate-limited and audit-logged per ISMS Policy AU-002.

  #### Since

  0.8.0

  #### See

  - monitorLegislativePipelineToolMetadata for MCP schema registration
  - handleTrackLegislation for individual procedure stage and timeline tracking
  - Defined in tools/monitorLegislativePipeline.ts:829