# Function handleGetExternalDocuments

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

  Handles the get_external_documents MCP tool request.

  Retrieves external documents (non-EP documents such as Council positions and Commission proposals) from the European Parliament data portal. Supports both a paginated list view and a single-document lookup when `docId` is provided.

  #### Parameters

  - args: unknown

    Raw tool arguments, validated against GetExternalDocumentsSchema

  #### Returns Promise<ToolResult>

  MCP tool result containing external document data (single document or paginated list)

  #### Throws

  - If `args` fails schema validation (e.g., invalid field types or formats)
  - If the European Parliament API is unreachable or returns an error response

  #### Example

      // Single document lookup
      const single = await handleGetExternalDocuments({ docId: 'COM-2024-123' });
      // Returns the external document with ID COM-2024-123

      // List documents (no year filter available in the EP API)
      const list = await handleGetExternalDocuments({ limit: 30, offset: 0 });
      // Returns up to 30 external documents

  #### Security

  - Input is validated with Zod before any API call.
  - Personal data in responses is minimised per GDPR Article 5(1)(c).
  - All requests are rate-limited and audit-logged per ISMS Policy AU-002.

  #### Since

  0.8.0

  #### See

  - getExternalDocumentsToolMetadata for MCP schema registration
  - handleSearchDocuments for full-text search across EP legislative documents
  - Defined in tools/getExternalDocuments.ts:57