Skip to content

Standardize MCP query patterns: explicit date filtering, data freshness validation#269

Merged
pethers merged 7 commits intomainfrom
copilot/fix-evening-news-generator
Feb 17, 2026
Merged

Standardize MCP query patterns: explicit date filtering, data freshness validation#269
pethers merged 7 commits intomainfrom
copilot/fix-evening-news-generator

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Agentic workflows relied on implicit "latest" data from MCP server without freshness validation or explicit date filtering. This caused potential stale data issues and inconsistent query patterns across workflows.

Changes

Standardized data freshness validation

  • All workflows now call get_sync_status() first to validate data age and warm MCP server
  • Warn when data >48 hours stale, require disclaimer in generated content
  • Prevents publishing articles/analysis with outdated information
// CALL THIS FIRST - validates freshness and warms up server
const syncStatus = get_sync_status({});
const hoursSinceSync = (Date.now() - new Date(syncStatus.last_updated).getTime()) / 3600000;
if (hoursSinceSync > 48) {
  console.warn(`⚠️ DATA MAY BE STALE: ${hoursSinceSync.toFixed(1)} hours since last sync`);
}

Date parameter support matrix

Only 3 of 32 riksdag-regering-mcp tools support explicit date parameters:

  • get_calendar_events (from/tom)
  • search_regering (from_date/to_date)
  • analyze_g0v_by_department (dateFrom/dateTo)

All other tools require post-query filtering by datum, publicerad, or inlämnad fields.

Tool annotations and filtering examples

// Tools requiring post-query filtering
const betankanden = get_betankanden({ rm: "2025/26", limit: 100 });
const recentBetankanden = betankanden.filter(bet => 
  new Date(bet.publicerad) >= new Date(fromDate)
);

Enhanced riksdag-regering-mcp skill (+235 lines)

  • MCP Query Best Practices section with data freshness checking
  • Cross-referencing strategies (Committee Report Deep Dive, Party Behavior Analysis)
  • Troubleshooting guide (7 common issues)
  • Query pattern templates (daily monitoring, weekly analysis, MP activity)

Test coverage

35-test validation suite ensures consistency:

  • Data freshness validation (6 tests)
  • Explicit date filtering (6 tests)
  • Post-query filtering docs (2 tests)
  • Cross-referencing strategy (1 test)
  • Error handling (6 tests)
  • MCP tool documentation (6 tests)
  • Date best practices (2 tests)
  • Workflow compilation (3 tests)
  • Regression prevention (2 tests)
  • Date parameter matrix (1 test)

Test results: 100% pass rate (35/35) across all 3 workflows
Compilation: 0 errors, 1 cosmetic warning (schedule timing)

Files modified

  • .github/workflows/news-evening-analysis.md (+175 lines)
  • .github/workflows/news-article-generator.md (+69 lines)
  • .github/workflows/news-realtime-monitor.md (+75 lines)
  • .github/skills/riksdag-regering-mcp/SKILL.md (+235 lines)
  • tests/agentic-workflow-mcp-queries.test.js (+437 lines)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 17, 2026 21:08
…te filtering, and cross-referencing examples

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
// Check for problematic implicit patterns
// Look for queries without any date awareness
const lines = content.split('\n');
let hasProblematicPattern = false;
Copilot AI changed the title [WIP] Fix evening news generator to use MPC latest data Fix evening news workflow: Replace implicit "latest" queries with explicit date filtering Feb 17, 2026
Copilot AI requested a review from pethers February 17, 2026 21:16
Copilot AI and others added 3 commits February 17, 2026 21:24
…tor.md (100% test pass)

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…- ALL TESTS PASS (100%)

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…ve MCP query best practices

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title Fix evening news workflow: Replace implicit "latest" queries with explicit date filtering Standardize MCP query patterns: explicit date filtering, data freshness validation Feb 17, 2026
@github-actions github-actions bot added documentation Documentation updates javascript JavaScript code changes workflow GitHub Actions workflows ci-cd CI/CD pipeline changes testing Test coverage skill Skill configuration news News articles and content generation agentic-workflow Agentic workflow changes size-xl Extra large change (> 1000 lines) labels Feb 17, 2026
@github-actions
Copy link
Contributor

🔍 Lighthouse Performance Audit

Category Score Status
Performance 85/100 🟡
Accessibility 95/100 🟢
Best Practices 90/100 🟢
SEO 95/100 🟢

📥 Download full Lighthouse report

Budget Compliance: Performance budgets enforced via budget.json

@pethers pethers marked this pull request as ready for review February 17, 2026 21:34
@pethers pethers merged commit ce8518b into main Feb 17, 2026
13 checks passed
@pethers pethers deleted the copilot/fix-evening-news-generator branch February 17, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflow Agentic workflow changes ci-cd CI/CD pipeline changes documentation Documentation updates javascript JavaScript code changes news News articles and content generation size-xl Extra large change (> 1000 lines) skill Skill configuration testing Test coverage workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments