Skip to content

feat(committee-reports): implement search_voteringar, search_anforanden, get_propositioner enrichment#608

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-missing-mcp-tools-committee-reports
Draft

feat(committee-reports): implement search_voteringar, search_anforanden, get_propositioner enrichment#608
Copilot wants to merge 2 commits intomainfrom
copilot/add-missing-mcp-tools-committee-reports

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

generateCommitteeReports() was calling only get_betankanden, leaving REQUIRED_TOOLS artificially reduced to 1 tool and articles devoid of voting context, debate highlights, or government bill linkage.

Implementation

scripts/news-types/committee-reports.ts

  • Restores REQUIRED_TOOLS to the full 4-tool spec
  • Fetches voting records, speeches, and propositions in parallel after the primary get_betankanden call; each is individually fault-tolerant via .catch(() => []) — no enrichment failure can abort article generation
  • Passes { reports, votes, speeches, propositions } to generateArticleContent and updates generateSources / crossReferences.sources accordingly
const [votes, speeches, propositions] = await Promise.all([
  Promise.resolve()
    .then(() => client.fetchVotingRecords({ rm: currentRm, limit: 20 }))
    .catch((err: unknown) => { console.error('...', (err as Error)?.message ?? String(err)); return []; }),
  Promise.resolve()
    .then(() => client.searchSpeeches({ rm: currentRm, limit: 15 }))
    .catch(...),
  Promise.resolve()
    .then(() => client.fetchPropositions(20))
    .catch(...),
]);
mcpCalls.push({ tool: 'search_voteringar', result: votes });
mcpCalls.push({ tool: 'search_anforanden', result: speeches });
mcpCalls.push({ tool: 'get_propositioner', result: propositions });

scripts/data-transformers/types.ts

  • Adds votes?: unknown[] and speeches?: unknown[] to ArticleContentData

scripts/data-transformers/content-generators.ts

  • Extends generateCommitteeContent with three optional sections rendered only when data is non-empty: Voting Results, Committee Debate, Government Bill Linkage (up to 3 linked proposition titles)
  • Each section uses inline per-language template maps covering all 14 supported languages (EN, SV, DA, NO, FI, DE, FR, ES, NL, AR, HE, JA, KO, ZH)

Tests (tests/news-types/committee-reports.test.ts)

  • Mock extended with fetchVotingRecords, searchSpeeches, fetchPropositions
  • REQUIRED_TOOLS assertion updated to the full 4-tool list
  • 4 new cross-referencing tests verify each tool is called and tracked in mcpCalls
  • 1 new test asserts all 4 sources appear in crossReferences.sources
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Committee Reports: Add voting patterns, debate context, and proposition linkage</issue_title>
<issue_description>## 📋 Issue Type
Enhancement — Implement missing MCP tools for committee reports: voting patterns, debate context, and proposition linkage

🎯 Objective

Implement the three TODO MCP tools in scripts/news-types/committee-reports.ts: search_voteringar (committee voting patterns), search_anforanden (committee member statements and debate), and get_propositioner (linkage to originating government proposals). These tools will transform committee report articles from basic report listings into comprehensive legislative intelligence.

📊 Current State

  • File: scripts/news-types/committee-reports.ts (425 lines)
  • Implemented tools: get_betankanden ✅ (only tool)
  • Missing tools: search_voteringar ❌, search_anforanden ❌, get_propositioner
  • REQUIRED_TOOLS: Only 1 tool (get_betankanden) — reduced from original 4 to avoid validation failures
  • Impact: Committee report articles list betänkanden metadata without voting results, debate highlights, or connection to originating government proposals

🚀 Desired State

  • Voting pattern analysis shows how each party voted on committee recommendations
  • Debate context captures key committee member arguments and dissenting views
  • Proposition linkage traces committee reports back to originating government bills
  • Minority report analysis identifies party splits within committees
  • Committee power mapping (which committees are most active/influential)
  • Cross-committee pattern detection (related reports from different committees)
  • "Legislative Impact" assessment for each betänkande

🔧 Implementation Approach

1. Add search_voteringar integration (~80 lines)

// Fetch voting records for committee report decisions
const votes = await mcpClient.call('search_voteringar', {
  bet: betankande.beteckning,
  rm: currentRiksmote,
  limit: 20
});
  • Parse party-level voting on each committee recommendation
  • Identify unanimous vs contentious decisions
  • Detect coalition vs opposition voting patterns
  • Calculate committee consensus scores

2. Add search_anforanden integration (~70 lines)

// Find committee debate speeches
const debates = await mcpClient.call('search_anforanden', {
  debattnamn: betankande.debattnamn || betankande.titel,
  rm: currentRiksmote,
  limit: 15
});
  • Extract committee chair statements
  • Capture minority report arguments
  • Identify key points of contention
  • Quote notable committee member interventions

3. Add get_propositioner integration (~50 lines)

// Link committee reports to originating government proposals
const propositioner = await mcpClient.call('get_propositioner', {
  rm: currentRiksmote,
  limit: 20
});
// Cross-reference by subject matter
const relatedPropositions = matchPropositionsToReports(propositioner, betankanden);
  • Trace each betänkande back to its originating proposition
  • Show how committee modified or endorsed government proposals
  • Identify where committee rejected or amended government bills

4. Update REQUIRED_TOOLS

Restore full 4-tool list: get_betankanden, search_voteringar, search_anforanden, get_propositioner

5. Enhanced article templates

  • Add "Voting Results" section with party breakdown per betänkande
  • Add "Committee Debate" highlights section
  • Add "Government Bill Linkage" tracing section
  • Add "Minority Reports" analysis where applicable
  • Add "Committee Spotlight" for most active/influential committees
  • Update all 14 language templates

🤖 Recommended Agent

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

✅ Acceptance Criteria

  • search_voteringar integrated for committee voting pattern analysis
  • search_anforanden integrated for committee debate context
  • get_propositioner integrated for government bill linkage
  • REQUIRED_TOOLS restored to full 4-tool specification
  • REQUIRED_TOOLS validation passes without warnings
  • Article templates include "Voting Results", "Debate", "Bill Linkage" sections
  • All 14 language templates updated
  • Committee coverage spans all 15 Riksdag committees
  • Minority report analysis identifies party splits
  • No regression in existing committee report 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/committee-reports.ts:78-81 (TODO comments)
  • File: scripts/news-types/committee-reports.ts:187-196 (REQUIRED_TOOLS update comment)
  • MCP Tools: search_voteringar, search_anforanden, get_propositioner
  • Content generators: scripts/data-transformers/content-generators.ts
  • Policy analysis:...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…committee-reports

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Enhance committee reports with missing MCP tools feat(committee-reports): implement search_voteringar, search_anforanden, get_propositioner enrichment 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 Committee Reports: Add voting patterns, debate context, and proposition linkage

2 participants