Skip to content

Implement full-text analysis, department impact, and debate context for propositions#604

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-full-text-analysis-tools-again
Draft

Implement full-text analysis, department impact, and debate context for propositions#604
Copilot wants to merge 3 commits intomainfrom
copilot/add-full-text-analysis-tools-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

propositions.ts was generating articles from get_propositioner metadata alone — no policy substance, no department context, no debate reactions. REQUIRED_TOOLS had been reverted to 1 tool to silence validation failures caused by the missing implementations.

MCP Tool Integrations

  • search_dokument_fulltext — fetches full policy text for the top proposition; extracts title/summary for a "Policy Substance" section
  • analyze_g0v_by_department — queries a 7-day rolling window of government documents by department; renders a "Department Impact" list
  • search_anforanden — retrieves parliamentary speeches mentioning the proposition; renders attributed blockquotes in a "Parliamentary Debate" section

All three calls use non-fatal try/catch — articles generate successfully even when enrichment tools are unavailable.

Article Template Additions (content-generators.ts)

Three new sections appended to generatePropositionsContent(), each with 14-language heading maps and consistent display limits:

const MAX_DISPLAY_ITEMS = 3;
const MAX_SPEECH_PREVIEW_LENGTH = 200;
// sections: .policy-substance, .department-impact, .debate-context

Data Flow

  • ArticleContentData extended with fullTextResults, departmentAnalysis, speechDebates
  • REQUIRED_TOOLS restored to full 4-tool list: get_propositioner, search_dokument_fulltext, analyze_g0v_by_department, search_anforanden
  • generateSources() updated to reflect all 4 tools

Test Coverage

  • Mock extended with request and searchSpeeches on MCPClient
  • New tests: 4-tool REQUIRED_TOOLS assertion, all-tools-called assertion, graceful degradation when enrichment tools throw
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Propositions: Add full-text analysis, department impact, and debate context</issue_title>
<issue_description>## 📋 Issue Type
Enhancement — Implement missing MCP tools for government propositions: full-text analysis, department impact, and debate context

🎯 Objective

Implement the three TODO MCP tools in scripts/news-types/propositions.ts: search_dokument_fulltext (full policy text analysis), analyze_g0v_by_department (government department impact mapping), and search_anforanden (parliamentary debate context). These tools will transform proposition articles from basic metadata summaries into comprehensive policy analysis pieces.

📊 Current State

  • File: scripts/news-types/propositions.ts (401 lines)
  • Implemented tools: get_propositioner ✅ (only tool)
  • Missing tools: search_dokument_fulltext ❌, analyze_g0v_by_department ❌, search_anforanden
  • REQUIRED_TOOLS: Only 1 tool (get_propositioner) — reduced from original 4 to avoid validation failures
  • Impact: Proposition articles only show basic metadata (title, date, document ID) without policy substance, department context, or debate reactions

🚀 Desired State

  • Full-text analysis extracts key policy provisions, budget allocations, and regulatory changes
  • Department impact mapping shows which ministries are affected and their responsibilities
  • Debate context includes ministerial presentations and opposition reactions
  • Articles explain what propositions actually propose (not just that they exist)
  • Budget impact estimates where available
  • Timeline for implementation (when laws take effect)
  • Cross-reference with related motions and committee assignments

🔧 Implementation Approach

1. Add search_dokument_fulltext integration (~80 lines)

// Extract policy substance from proposition full text
const fullText = await mcpClient.call('search_dokument_fulltext', {
  query: proposition.titel,
  limit: 3
});
  • Parse key policy provisions from full text
  • Extract budget figures and regulatory changes
  • Identify implementation timelines and affected populations
  • Use scripts/data-transformers/policy-analysis.ts for domain detection

2. Add analyze_g0v_by_department integration (~60 lines)

// Map proposition to responsible departments
const departmentAnalysis = await mcpClient.call('analyze_g0v_by_department', {
  dateFrom: propositionDate,
  dateTo: propositionDate
});
  • Identify lead ministry and supporting departments
  • Track ministerial ownership of policy areas
  • Add department context to article (who's responsible for implementation)

3. Add search_anforanden integration (~60 lines)

// Find debate speeches about this proposition
const debates = await mcpClient.call('search_anforanden', {
  text: proposition.titel,
  rm: currentRiksmote,
  limit: 10
});
  • Extract ministerial presentation quotes
  • Capture opposition reaction highlights
  • Identify party positions on the proposition

4. Update REQUIRED_TOOLS

Restore full 4-tool list: get_propositioner, search_dokument_fulltext, analyze_g0v_by_department, search_anforanden

5. Enhanced article templates

  • Add "Policy Substance" section with key provisions
  • Add "Department Impact" sidebar
  • Add "Parliamentary Debate" quotes section
  • Add "Budget Impact" where applicable
  • Update all 14 language templates

🤖 Recommended Agent

code-quality-engineer — TypeScript implementation matching existing MCP integration patterns

✅ Acceptance Criteria

  • search_dokument_fulltext integrated for policy substance extraction
  • analyze_g0v_by_department integrated for department impact mapping
  • search_anforanden integrated for debate context
  • REQUIRED_TOOLS restored to full 4-tool specification
  • REQUIRED_TOOLS validation passes without warnings
  • Article templates include "Policy Substance", "Department Impact", "Debate" sections
  • All 14 language templates updated
  • No regression in existing proposition generation
  • Performance within 20-second batch target for all languages
  • Error handling for tools that return empty results (graceful degradation)

📚 References

  • File: scripts/news-types/propositions.ts:49-52 (TODO comments)
  • File: scripts/news-types/propositions.ts:187-196 (REQUIRED_TOOLS update comment)
  • MCP Tools: search_dokument_fulltext, analyze_g0v_by_department, search_anforanden
  • Policy analysis: scripts/data-transformers/policy-analysis.ts
  • Document analysis: scripts/data-transformers/document-analysis.ts
  • Pattern reference: scripts/news-types/weekly-review.ts (full enrichment pipeline example)
    </issue_description>

<agent_instructions>Implement the three TODO MCP tools in scripts/news-types/propositions.ts: search_dokument_fulltext, analyze_g0v_by_department, search_anforanden. Resto...


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits February 26, 2026 21:10
…_anforanden in propositions.ts; restore REQUIRED_TOOLS to 4 tools; add Policy Substance, Department Impact, Debate sections

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…r department analysis

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance propositions with full-text analysis and departmental impact Implement full-text analysis, department impact, and debate context for propositions Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Propositions: Add full-text analysis, department impact, and debate context

2 participants